Refactor ScalarType, remove convertFromMillis() method (no longer needed)

Due to the move and change of CsvReader using StringParser ScalarType no longer
needs that general convertFromMillis() method. Note that date and dateTime ScalarTypes
still retain this conversion method.
This commit is contained in:
Rob Bygrave
2022-08-25 22:37:47 +12:00
parent f98b6b0e2a
commit c5e8b217e3
27 changed files with 4 additions and 139 deletions
@@ -75,11 +75,6 @@ class ScalarTypeDurationTest {
assertEquals(Duration.ofSeconds(1234), duration);
}
@Test
void testConvertFromMillis() {
assertThrows(UnsupportedOperationException.class, () -> type.convertFromMillis(1000));
}
@Test
void testJsonRead() throws Exception {
Duration duration = Duration.ofSeconds(1234);
@@ -75,11 +75,6 @@ class ScalarTypeDurationWithNanosTest {
assertEquals(duration, val1);
}
@Test
void testConvertFromMillis() {
assertThrows(UnsupportedOperationException.class, () -> type.convertFromMillis(1000));
}
@Test
void testJsonRead() throws Exception {
Duration duration = Duration.ofSeconds(323, 1500000);
@@ -1,6 +1,5 @@
package io.ebeaninternal.server.type;
import io.ebean.text.TextException;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
@@ -10,7 +9,8 @@ import java.io.ObjectOutputStream;
import java.sql.Time;
import java.time.LocalTime;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
public class ScalarTypeLocalTimeTest {
@@ -77,11 +77,6 @@ public class ScalarTypeLocalTimeTest {
assertEquals(localTime, val1);
}
@Test
public void testConvertFromMillis() {
assertThrows(TextException.class, () -> type.convertFromMillis(1234));
}
@Test
public void testJsonRead() throws Exception {
LocalTime localTime = LocalTime.of(9, 23, 45);
@@ -1,6 +1,5 @@
package io.ebeaninternal.server.type;
import io.ebean.text.TextException;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
@@ -9,7 +8,8 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.time.LocalTime;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
public class ScalarTypeLocalTimeWithNanosTest {
@@ -74,11 +74,6 @@ public class ScalarTypeLocalTimeWithNanosTest {
assertEquals(localTime, val1);
}
@Test
public void testConvertFromMillis() {
assertThrows(TextException.class, () -> type.convertFromMillis(1234));
}
@Test
public void testJsonRead() throws Exception {
LocalTime localTime = LocalTime.of(9, 23, 45);
@@ -7,7 +7,6 @@ import java.time.LocalDate;
import java.time.MonthDay;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class ScalarTypeMonthDayTest {
@@ -49,11 +48,6 @@ public class ScalarTypeMonthDayTest {
assertEquals(value, monthDay);
}
@Test
public void testConvertFromMillis() {
assertThrows(RuntimeException.class, () -> type.convertFromMillis(1203));
}
@Test
public void testJson() throws Exception {
MonthDay value = MonthDay.of(4, 29);
@@ -45,16 +45,6 @@ public class ScalarTypePostgresHstoreTest {
assertEquals("rob", map.get("name"));
}
@Test
@SuppressWarnings("unchecked")
public void testParseDateTime() {
assertThrows(RuntimeException.class, () -> {
Map<String, Object> map = (Map<String, Object>) hstore.convertFromMillis(1234L);
assertEquals(1, map.size());
assertEquals("rob", map.get("name"));
});
}
@Test
public void testJsonWrite() throws Exception {
Map<String, Object> map = new LinkedHashMap<>();
@@ -70,11 +70,6 @@ class ScalarTypeYearTest {
assertEquals(Year.of(2013), year);
}
@Test
void testConvertFromMillis() {
assertThrows(UnsupportedOperationException.class, () -> type.convertFromMillis(1000));
}
@Test
void testJson() throws Exception {
JsonTester<Year> jsonTester = new JsonTester<>(type);