use of org.skife.jdbi.v2.exceptions.NoResultsException in project dropwizard by dropwizard.
the class LoggingDBIExceptionMapperTest method testSqlExceptionIsCause.
@Test
public void testSqlExceptionIsCause() throws Exception {
StatementContext statementContext = mock(StatementContext.class);
RuntimeException runtimeException = new RuntimeException("DB is down");
SQLException sqlException = new SQLException("DB error", runtimeException);
DBIException dbiException = new NoResultsException("Unable get a result set", sqlException, statementContext);
dbiExceptionMapper.logException(9812, dbiException);
verify(logger).error("Error handling a request: 0000000000002654", sqlException);
verify(logger).error("Error handling a request: 0000000000002654", runtimeException);
verify(logger, never()).error("Error handling a request: 0000000000002654", dbiException);
}
Aggregations