fixed tests

This commit is contained in:
anhefti 2019-05-02 16:02:37 +02:00
parent e2383fa4b3
commit 529e8c2f83

View file

@ -26,7 +26,7 @@ import org.mockito.Mockito;
public class JodaTimeTypeResolverTest { public class JodaTimeTypeResolverTest {
@Test @Test
public void testGetNullableResultExceptions() throws SQLException { public void testNull() throws SQLException {
final String columnName = "timestamp"; final String columnName = "timestamp";
final JodaTimeTypeResolver jodaTimeTypeResolver = new JodaTimeTypeResolver(); final JodaTimeTypeResolver jodaTimeTypeResolver = new JodaTimeTypeResolver();
@ -34,14 +34,8 @@ public class JodaTimeTypeResolverTest {
final ResultSet resultSetMock = Mockito.mock(ResultSet.class); final ResultSet resultSetMock = Mockito.mock(ResultSet.class);
when(resultSetMock.getString(columnName)).thenReturn(null); when(resultSetMock.getString(columnName)).thenReturn(null);
try { final DateTime nullableResult = jodaTimeTypeResolver.getNullableResult(resultSetMock, columnName);
@SuppressWarnings("unused") assertNull(nullableResult);
final DateTime nullableResult = jodaTimeTypeResolver.getNullableResult(resultSetMock, columnName);
fail("Exception expected here");
} catch (final Exception e) {
assertEquals("Failed to parse date-time from SQL string: null", e.getMessage());
}
} }
@Test @Test