[jdbc] Improve conversion of database value to item state (#15434)

* Improve conversion of database value to item state
* Refactor test cases to reduce redundancy
* Refactor for type-safety
* Refactor type cast

Fixes #15433

---------

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2023-09-23 17:34:06 +02:00 committed by GitHub
parent e847139f97
commit 619dd617aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 140 additions and 143 deletions

View File

@ -472,7 +472,7 @@ public class JdbcBaseDAO {
}
// we already retrieve the unit here once as it is a very costly operation
String itemName = item.getName();
Unit<? extends Quantity<?>> unit = item instanceof NumberItem ? ((NumberItem) item).getUnit() : null;
Unit<? extends Quantity<?>> unit = item instanceof NumberItem numberItem ? numberItem.getUnit() : null;
return m.stream()
.map(o -> new JdbcHistoricItem(itemName, objectAsState(item, unit, o[1]), objectAsZonedDateTime(o[0])))
.collect(Collectors.<HistoricItem> toList());
@ -588,10 +588,10 @@ public class JdbcBaseDAO {
break;
case "NUMBERITEM":
State convertedState = itemState;
if (item instanceof NumberItem && itemState instanceof QuantityType) {
Unit<? extends Quantity<?>> unit = ((NumberItem) item).getUnit();
if (item instanceof NumberItem numberItem && itemState instanceof QuantityType<?> quantityState) {
Unit<? extends Quantity<?>> unit = numberItem.getUnit();
if (unit != null && !Units.ONE.equals(unit)) {
convertedState = ((QuantityType<?>) itemState).toUnit(unit);
convertedState = quantityState.toUnit(unit);
if (convertedState == null) {
logger.warn(
"JDBC::storeItemValueProvider: Failed to convert state '{}' to unit '{}'. Please check your item definition for correctness.",
@ -667,14 +667,14 @@ public class JdbcBaseDAO {
throw new UnsupportedOperationException("No SQL type defined for item type NUMBERITEM");
}
if (it.toUpperCase().contains("DOUBLE")) {
return unit == null ? new DecimalType(((Number) v).doubleValue())
: QuantityType.valueOf(((Number) v).doubleValue(), unit);
return unit == null ? new DecimalType(objectAsNumber(v).doubleValue())
: QuantityType.valueOf(objectAsNumber(v).doubleValue(), unit);
} else if (it.toUpperCase().contains("DECIMAL") || it.toUpperCase().contains("NUMERIC")) {
return unit == null ? new DecimalType((BigDecimal) v)
: QuantityType.valueOf(((BigDecimal) v).doubleValue(), unit);
return unit == null ? new DecimalType(objectAsBigDecimal(v))
: QuantityType.valueOf(objectAsBigDecimal(v).doubleValue(), unit);
} else if (it.toUpperCase().contains("INT")) {
return unit == null ? new DecimalType(objectAsInteger(v))
: QuantityType.valueOf(((Integer) v).doubleValue(), unit);
: QuantityType.valueOf(objectAsInteger(v).doubleValue(), unit);
}
return unit == null ? DecimalType.valueOf(objectAsString(v)) : QuantityType.valueOf(objectAsString(v));
} else if (item instanceof DateTimeItem) {
@ -686,13 +686,17 @@ public class JdbcBaseDAO {
} else if (item instanceof ImageItem) {
return RawType.valueOf(objectAsString(v));
} else if (item instanceof ContactItem || item instanceof PlayerItem || item instanceof SwitchItem) {
State state = TypeParser.parseState(item.getAcceptedDataTypes(), ((String) v).trim());
State state = TypeParser.parseState(item.getAcceptedDataTypes(), objectAsString(v).trim());
if (state == null) {
throw new UnsupportedOperationException("Unable to parse state for item " + item.toString());
}
return state;
} else {
State state = TypeParser.parseState(item.getAcceptedDataTypes(), ((String) v));
if (!(v instanceof String objectAsString)) {
throw new UnsupportedOperationException(
"Type '" + v.getClass().getName() + "' is not supported for item " + item.toString());
}
State state = TypeParser.parseState(item.getAcceptedDataTypes(), objectAsString);
if (state == null) {
throw new UnsupportedOperationException("Unable to parse state for item " + item.toString());
}
@ -703,46 +707,65 @@ public class JdbcBaseDAO {
protected ZonedDateTime objectAsZonedDateTime(Object v) {
if (v instanceof Long) {
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(((Number) v).longValue()), ZoneId.systemDefault());
} else if (v instanceof java.sql.Date) {
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(((java.sql.Date) v).getTime()), ZoneId.systemDefault());
} else if (v instanceof LocalDateTime) {
return ((LocalDateTime) v).atZone(ZoneId.systemDefault());
} else if (v instanceof Instant) {
return ((Instant) v).atZone(ZoneId.systemDefault());
} else if (v instanceof java.sql.Timestamp) {
return ((java.sql.Timestamp) v).toInstant().atZone(ZoneId.systemDefault());
} else if (v instanceof java.lang.String) {
return ZonedDateTime.ofInstant(java.sql.Timestamp.valueOf(v.toString()).toInstant(),
} else if (v instanceof java.sql.Date objectAsDate) {
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(objectAsDate.getTime()), ZoneId.systemDefault());
} else if (v instanceof LocalDateTime objectAsLocalDateTime) {
return objectAsLocalDateTime.atZone(ZoneId.systemDefault());
} else if (v instanceof Instant objectAsInstant) {
return objectAsInstant.atZone(ZoneId.systemDefault());
} else if (v instanceof java.sql.Timestamp objectAsTimestamp) {
return objectAsTimestamp.toInstant().atZone(ZoneId.systemDefault());
} else if (v instanceof java.lang.String objectAsString) {
return ZonedDateTime.ofInstant(java.sql.Timestamp.valueOf(objectAsString).toInstant(),
ZoneId.systemDefault());
}
throw new UnsupportedOperationException("Date of type " + v.getClass().getName() + " is not supported");
throw new UnsupportedOperationException("Date of type '" + v.getClass().getName() + "' is not supported");
}
protected Integer objectAsInteger(Object v) {
if (v instanceof Byte) {
return ((Byte) v).intValue();
} else if (v instanceof Integer) {
return (Integer) v;
}
return ((Integer) v).intValue();
throw new UnsupportedOperationException("Integer of type '" + v.getClass().getName() + "' is not supported");
}
protected Number objectAsNumber(Object value) {
if (value instanceof Number valueAsNumber) {
return valueAsNumber;
}
throw new UnsupportedOperationException("Number of type '" + value.getClass().getName() + "' is not supported");
}
protected BigDecimal objectAsBigDecimal(Object value) {
if (value instanceof BigDecimal valueAsBigDecimal) {
return valueAsBigDecimal;
}
throw new UnsupportedOperationException(
"BigDecimal of type '" + value.getClass().getName() + "' is not supported");
}
protected String objectAsString(Object v) {
if (v instanceof byte[]) {
return new String((byte[]) v);
if (v instanceof byte[] objectAsBytes) {
return new String(objectAsBytes);
} else if (v instanceof String objectAsString) {
return objectAsString;
}
return ((String) v);
throw new UnsupportedOperationException("String of type '" + v.getClass().getName() + "' is not supported");
}
public String getItemType(Item i) {
Item item = i;
String def = "STRINGITEM";
if (i instanceof GroupItem) {
item = ((GroupItem) i).getBaseItem();
if (i instanceof GroupItem groupItem) {
item = groupItem.getBaseItem();
if (item == null) {
// if GroupItem:<ItemType> is not defined in *.items using StringType
logger.debug(
"JDBC::getItemType: Cannot detect ItemType for {} because the GroupItems' base type isn't set in *.items File.",
i.getName());
Iterator<Item> iterator = ((GroupItem) i).getMembers().iterator();
Iterator<Item> iterator = groupItem.getMembers().iterator();
if (!iterator.hasNext()) {
logger.debug(
"JDBC::getItemType: No Child-Members of GroupItem {}, use ItemType for STRINGITEM as Fallback",

View File

@ -16,6 +16,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.time.Instant;
import java.time.LocalDateTime;
@ -23,10 +24,19 @@ import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
import java.util.stream.Stream;
import javax.measure.Quantity;
import javax.measure.Unit;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.openhab.core.items.Item;
import org.openhab.core.library.items.CallItem;
import org.openhab.core.library.items.ColorItem;
import org.openhab.core.library.items.ContactItem;
@ -74,126 +84,90 @@ public class JdbcBaseDAOTest {
private @NonNullByDefault({}) FilterCriteria filter;
@BeforeEach
public void setup() {
void setup() {
filter = new FilterCriteria();
}
@Test
public void testObjectAsStateReturnsValidState() {
State decimalType = jdbcBaseDAO.objectAsState(new NumberItem("testNumberItem"), null, 7.3);
assertInstanceOf(DecimalType.class, decimalType);
assertEquals(DecimalType.valueOf("7.3"), decimalType);
State quantityType = jdbcBaseDAO.objectAsState(new NumberItem("testNumberItem"), SIUnits.CELSIUS, 7.3);
assertInstanceOf(QuantityType.class, quantityType);
assertEquals(QuantityType.valueOf("7.3 °C"), quantityType);
@ParameterizedTest
@MethodSource("provideTestCasesForObjectAsStateValid")
void objectAsStateReturnsValidStateForCompatibleType(Item item, Object value,
@Nullable Unit<? extends Quantity<?>> unit, Object expected) {
State actual = jdbcBaseDAO.objectAsState(item, unit, value);
assertInstanceOf(expected.getClass(), actual, item.getName());
assertEquals(expected, actual, item.getName());
}
State hsbType = jdbcBaseDAO.objectAsState(new ColorItem("testColorItem"), null, "184,100,52");
assertInstanceOf(HSBType.class, hsbType);
assertEquals(HSBType.valueOf("184,100,52"), hsbType);
private static Stream<Arguments> provideTestCasesForObjectAsStateValid() {
return Stream.of( //
Arguments.of(new ImageItem("String_ImageItem"),
new RawType(new byte[0], "application/octet-stream").toFullString(), null,
new RawType(new byte[0], "application/octet-stream")),
Arguments.of(new NumberItem("Float_NumberItem"), 7.3, null, DecimalType.valueOf("7.3")),
Arguments.of(new NumberItem("Float_NumberItem_Unit"), 7.3, SIUnits.CELSIUS,
QuantityType.valueOf("7.3 °C")),
Arguments.of(new ContactItem("String_ContactItem"), "OPEN", null, OpenClosedType.OPEN),
Arguments.of(new PlayerItem("String_PlayerItem_Play"), "PLAY", null, PlayPauseType.PLAY),
Arguments.of(new PlayerItem("String_PlayerItem_Rewind"), "REWIND", null, RewindFastforwardType.REWIND),
Arguments.of(new CallItem("String_CallItem"), "0699222222,0179999998", null,
StringListType.valueOf("0699222222,0179999998")),
Arguments.of(new StringItem("String_StringItem"), "String", null, StringType.valueOf("String")),
Arguments.of(new SwitchItem("String_SwitchItem"), "ON", null, OnOffType.ON),
Arguments.of(new DimmerItem("Integer_DimmerItem"), 52, null, PercentType.valueOf("52")),
Arguments.of(new RollershutterItem("Integer_RollershutterItem"), 39, null, PercentType.valueOf("39")),
Arguments.of(new ColorItem("CharArray_ColorItem"),
new byte[] { (byte) '1', (byte) '8', (byte) '4', (byte) ',', (byte) '1', (byte) '0', (byte) '0',
(byte) ',', (byte) '5', (byte) '2' },
null, HSBType.valueOf("184,100,52")),
Arguments.of(new ColorItem("String_ColorItem"), "184,100,52", null, HSBType.valueOf("184,100,52")),
Arguments.of(new LocationItem("String_LocationItem"), "1,2,3", null, PointType.valueOf("1,2,3")),
Arguments.of(new DateTimeItem("Timestamp_DateTimeItem"),
java.sql.Timestamp.valueOf("2021-02-01 23:30:02.049"), null,
DateTimeType.valueOf("2021-02-01T23:30:02.049")),
Arguments.of(new DateTimeItem("LocalDateTime_DateTimeItem"),
LocalDateTime.parse("2021-02-01T23:30:02.049"), null,
DateTimeType.valueOf("2021-02-01T23:30:02.049")),
Arguments.of(new DateTimeItem("Long_DateTimeItem"), Long.valueOf("1612222202049"), null,
new DateTimeType(ZonedDateTime.ofInstant(Instant.parse("2021-02-01T23:30:02.049Z"),
ZoneId.systemDefault()))),
Arguments.of(new DateTimeItem("Date_DateTimeItem"), java.sql.Date.valueOf("2021-02-01"), null,
DateTimeType.valueOf("2021-02-01T00:00:00.000")),
Arguments.of(new DateTimeItem("Instant_DateTimeItem"), Instant.parse("2021-02-01T23:30:02.049Z"), null,
new DateTimeType(ZonedDateTime.ofInstant(Instant.parse("2021-02-01T23:30:02.049Z"),
ZoneId.systemDefault()))),
Arguments.of(new DateTimeItem("String_DateTimeItem"), "2021-02-01 23:30:02.049", null,
DateTimeType.valueOf("2021-02-01T23:30:02.049")));
}
State percentType = jdbcBaseDAO.objectAsState(new DimmerItem("testDimmerItem"), null, 52);
assertInstanceOf(PercentType.class, percentType);
assertEquals(PercentType.valueOf("52"), percentType);
@ParameterizedTest
@MethodSource("provideTestCasesForObjectAsStateInvalid")
void objectAsStateThrowsUnsupportedOperationExceptionForIncompatibleType(Item item, Object value,
@Nullable Unit<? extends Quantity<?>> unit) {
assertThrows(UnsupportedOperationException.class, () -> {
jdbcBaseDAO.objectAsState(item, unit, value);
}, item.getName());
}
percentType = jdbcBaseDAO.objectAsState(new RollershutterItem("testRollershutterItem"), null, 39);
assertInstanceOf(PercentType.class, percentType);
assertEquals(PercentType.valueOf("39"), percentType);
State openClosedType = jdbcBaseDAO.objectAsState(new ContactItem("testContactItem"), null, "OPEN");
assertInstanceOf(OpenClosedType.class, openClosedType);
assertThat(openClosedType, is(OpenClosedType.OPEN));
State playPauseType = jdbcBaseDAO.objectAsState(new PlayerItem("testPlayerItem"), null, "PLAY");
assertInstanceOf(PlayPauseType.class, playPauseType);
assertThat(playPauseType, is(PlayPauseType.PLAY));
State rewindFastforwardType = jdbcBaseDAO.objectAsState(new PlayerItem("testPlayerItem"), null, "REWIND");
assertInstanceOf(RewindFastforwardType.class, rewindFastforwardType);
assertThat(rewindFastforwardType, is(RewindFastforwardType.REWIND));
State onOffType = jdbcBaseDAO.objectAsState(new SwitchItem("testSwitchItem"), null, "ON");
assertInstanceOf(OnOffType.class, onOffType);
assertThat(onOffType, is(OnOffType.ON));
State stringListType = jdbcBaseDAO.objectAsState(new CallItem("testCallItem"), null, "0699222222,0179999998");
assertInstanceOf(StringListType.class, stringListType);
assertEquals(StringListType.valueOf("0699222222,0179999998"), stringListType);
State expectedRawType = new RawType(new byte[0], "application/octet-stream");
State rawType = jdbcBaseDAO.objectAsState(new ImageItem("testImageItem"), null, expectedRawType.toFullString());
assertInstanceOf(RawType.class, rawType);
assertThat(rawType, is(expectedRawType));
State pointType = jdbcBaseDAO.objectAsState(new LocationItem("testLocationItem"), null, "1,2,3");
assertInstanceOf(PointType.class, pointType);
assertEquals(PointType.valueOf("1,2,3"), pointType);
State stringType = jdbcBaseDAO.objectAsState(new StringItem("testStringItem"), null, "String");
assertInstanceOf(StringType.class, stringType);
assertEquals(StringType.valueOf("String"), stringType);
private static Stream<Arguments> provideTestCasesForObjectAsStateInvalid() {
return Stream.of( //
Arguments.of(new SwitchItem("Integer_SwitchItem"), 1, null),
Arguments.of(new RollershutterItem("String_RollershutterItem"), "39", null),
Arguments.of(new ColorItem("Integer_ColorItem"), 5, null), //
Arguments.of(new NumberItem("Timestamp_NumberItem"), java.sql.Timestamp.valueOf("2023-08-15 21:02:06"),
null),
Arguments.of(new NumberItem("Timestamp_NumberItem_Unit"),
java.sql.Timestamp.valueOf("2023-08-15 21:02:06"), SIUnits.CELSIUS),
Arguments.of(new LocationItem("Timestamp_LocationItem"),
java.sql.Timestamp.valueOf("2023-08-15 21:02:06"), null));
}
@Test
public void objectAsStateReturnsValiDateTimeTypeForTimestamp() {
State dateTimeType = jdbcBaseDAO.objectAsState(new DateTimeItem("testDateTimeItem"), null,
java.sql.Timestamp.valueOf("2021-02-01 23:30:02.049"));
assertInstanceOf(DateTimeType.class, dateTimeType);
assertEquals(DateTimeType.valueOf("2021-02-01T23:30:02.049"), dateTimeType);
}
@Test
public void objectAsStateReturnsValidDateTimeTypeForLocalDateTime() {
State dateTimeType = jdbcBaseDAO.objectAsState(new DateTimeItem("testDateTimeItem"), null,
LocalDateTime.parse("2021-02-01T23:30:02.049"));
assertInstanceOf(DateTimeType.class, dateTimeType);
assertEquals(DateTimeType.valueOf("2021-02-01T23:30:02.049"), dateTimeType);
}
@Test
public void objectAsStateReturnsValidDateTimeTypeForLong() {
State dateTimeType = jdbcBaseDAO.objectAsState(new DateTimeItem("testDateTimeItem"), null,
Long.valueOf("1612222202049"));
assertInstanceOf(DateTimeType.class, dateTimeType);
assertEquals(
new DateTimeType(
ZonedDateTime.ofInstant(Instant.parse("2021-02-01T23:30:02.049Z"), ZoneId.systemDefault())),
dateTimeType);
}
@Test
public void objectAsStateReturnsValidDateTimeTypeForSqlDate() {
State dateTimeType = jdbcBaseDAO.objectAsState(new DateTimeItem("testDateTimeItem"), null,
java.sql.Date.valueOf("2021-02-01"));
assertInstanceOf(DateTimeType.class, dateTimeType);
assertEquals(DateTimeType.valueOf("2021-02-01T00:00:00.000"), dateTimeType);
}
@Test
public void objectAsStateReturnsValidDateTimeTypeForInstant() {
State dateTimeType = jdbcBaseDAO.objectAsState(new DateTimeItem("testDateTimeItem"), null,
Instant.parse("2021-02-01T23:30:02.049Z"));
assertInstanceOf(DateTimeType.class, dateTimeType);
assertEquals(
new DateTimeType(
ZonedDateTime.ofInstant(Instant.parse("2021-02-01T23:30:02.049Z"), ZoneId.systemDefault())),
dateTimeType);
}
@Test
public void objectAsStateReturnsValidDateTimeTypeForString() {
State dateTimeType = jdbcBaseDAO.objectAsState(new DateTimeItem("testDateTimeItem"), null,
"2021-02-01 23:30:02.049");
assertInstanceOf(DateTimeType.class, dateTimeType);
assertEquals(DateTimeType.valueOf("2021-02-01T23:30:02.049"), dateTimeType);
}
@Test
public void testHistItemFilterQueryProviderReturnsSelectQueryWithoutWhereClauseDescendingOrder() {
void testHistItemFilterQueryProviderReturnsSelectQueryWithoutWhereClauseDescendingOrder() {
String sql = jdbcBaseDAO.histItemFilterQueryProvider(filter, 0, DB_TABLE_NAME, "TEST", UTC_ZONE_ID);
assertThat(sql, is("SELECT time, value FROM " + DB_TABLE_NAME + " ORDER BY time DESC"));
}
@Test
public void testHistItemFilterQueryProviderReturnsSelectQueryWithoutWhereClauseAscendingOrder() {
void testHistItemFilterQueryProviderReturnsSelectQueryWithoutWhereClauseAscendingOrder() {
filter.setOrdering(Ordering.ASCENDING);
String sql = jdbcBaseDAO.histItemFilterQueryProvider(filter, 0, DB_TABLE_NAME, "TEST", UTC_ZONE_ID);
@ -201,7 +175,7 @@ public class JdbcBaseDAOTest {
}
@Test
public void testHistItemFilterQueryProviderWithStartAndEndDateReturnsDeleteQueryWithWhereClauseDescendingOrder() {
void testHistItemFilterQueryProviderWithStartAndEndDateReturnsDeleteQueryWithWhereClauseDescendingOrder() {
filter.setBeginDate(parseDateTimeString("2022-01-10T15:01:44"));
filter.setEndDate(parseDateTimeString("2022-01-15T15:01:44"));
@ -213,7 +187,7 @@ public class JdbcBaseDAOTest {
}
@Test
public void testHistItemFilterQueryProviderReturnsSelectQueryWithoutWhereClauseDescendingOrderAndLimit() {
void testHistItemFilterQueryProviderReturnsSelectQueryWithoutWhereClauseDescendingOrderAndLimit() {
filter.setPageSize(1);
String sql = jdbcBaseDAO.histItemFilterQueryProvider(filter, 0, DB_TABLE_NAME, "TEST", UTC_ZONE_ID);
@ -221,13 +195,13 @@ public class JdbcBaseDAOTest {
}
@Test
public void testHistItemFilterDeleteProviderReturnsDeleteQueryWithoutWhereClause() {
void testHistItemFilterDeleteProviderReturnsDeleteQueryWithoutWhereClause() {
String sql = jdbcBaseDAO.histItemFilterDeleteProvider(filter, DB_TABLE_NAME, UTC_ZONE_ID);
assertThat(sql, is("TRUNCATE TABLE " + DB_TABLE_NAME));
}
@Test
public void testHistItemFilterDeleteProviderWithStartAndEndDateReturnsDeleteQueryWithWhereClause() {
void testHistItemFilterDeleteProviderWithStartAndEndDateReturnsDeleteQueryWithWhereClause() {
filter.setBeginDate(parseDateTimeString("2022-01-10T15:01:44"));
filter.setEndDate(parseDateTimeString("2022-01-15T15:01:44"));
@ -239,13 +213,13 @@ public class JdbcBaseDAOTest {
}
@Test
public void testResolveTimeFilterWithNoDatesReturnsEmptyString() {
void testResolveTimeFilterWithNoDatesReturnsEmptyString() {
String sql = jdbcBaseDAO.resolveTimeFilter(filter, UTC_ZONE_ID);
assertThat(sql, is(""));
}
@Test
public void testResolveTimeFilterWithStartDateOnlyReturnsWhereClause() {
void testResolveTimeFilterWithStartDateOnlyReturnsWhereClause() {
filter.setBeginDate(parseDateTimeString("2022-01-10T15:01:44"));
String sql = jdbcBaseDAO.resolveTimeFilter(filter, UTC_ZONE_ID);
@ -254,7 +228,7 @@ public class JdbcBaseDAOTest {
}
@Test
public void testResolveTimeFilterWithEndDateOnlyReturnsWhereClause() {
void testResolveTimeFilterWithEndDateOnlyReturnsWhereClause() {
filter.setEndDate(parseDateTimeString("2022-01-15T15:01:44"));
String sql = jdbcBaseDAO.resolveTimeFilter(filter, UTC_ZONE_ID);
@ -263,7 +237,7 @@ public class JdbcBaseDAOTest {
}
@Test
public void testResolveTimeFilterWithStartAndEndDateReturnsWhereClauseWithTwoConditions() {
void testResolveTimeFilterWithStartAndEndDateReturnsWhereClauseWithTwoConditions() {
filter.setBeginDate(parseDateTimeString("2022-01-10T15:01:44"));
filter.setEndDate(parseDateTimeString("2022-01-15T15:01:44"));