use of java.time.LocalDateTime in project dropwizard by dropwizard.
the class LocalDateTimeArgumentTest method apply.
@Test
public void apply() throws Exception {
LocalDateTime localDateTime = LocalDateTime.parse("2007-12-03T10:15:30.375");
new LocalDateTimeArgument(localDateTime).apply(1, statement, context);
Mockito.verify(statement).setTimestamp(1, Timestamp.valueOf("2007-12-03 10:15:30.375"));
}
use of java.time.LocalDateTime in project dropwizard by dropwizard.
the class LocalDateTimeMapperTest method mapColumnByName_TimestampIsNull.
@Test
public void mapColumnByName_TimestampIsNull() throws Exception {
when(resultSet.getTimestamp("name")).thenReturn(null);
LocalDateTime actual = new LocalDateTimeMapper().mapColumn(resultSet, "name", null);
assertThat(actual).isNull();
}
use of java.time.LocalDateTime in project dropwizard by dropwizard.
the class LocalDateTimeMapperTest method mapColumnByIndex.
@Test
public void mapColumnByIndex() throws Exception {
when(resultSet.getTimestamp(1)).thenReturn(Timestamp.valueOf("2007-12-03 10:15:30.375"));
LocalDateTime actual = new LocalDateTimeMapper().mapColumn(resultSet, 1, null);
assertThat(actual).isEqualTo(LocalDateTime.parse("2007-12-03T10:15:30.375"));
}
use of java.time.LocalDateTime in project dropwizard by dropwizard.
the class LocalDateTimeMapperTest method mapColumnByIndex_TimestampIsNull.
@Test
public void mapColumnByIndex_TimestampIsNull() throws Exception {
when(resultSet.getTimestamp(1)).thenReturn(null);
LocalDateTime actual = new LocalDateTimeMapper().mapColumn(resultSet, 1, null);
assertThat(actual).isNull();
}
use of java.time.LocalDateTime in project dropwizard by dropwizard.
the class OptionalLocalDateTimeTest method testPresent.
@Test
public void testPresent() {
final LocalDateTime startDate = LocalDateTime.now();
final LocalDateTime endDate = startDate.plusDays(1L);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.empty());
assertThat(dao.findEndDateById(1).get()).isEqualTo(endDate);
}
Aggregations