@SuppressWarnings("static-access")
@Test
public void testClosePreparedStatementWhenPreparedStatementIsNotNullAndThereIsException() throws Exception {

    SQLException sqlException = new SQLException();
    doThrow(sqlException).when(preparedStatementMock).close();
    PreparedStatement preparedStatement = preparedStatementMock;
    String errorMessage = "some message";
    dao.closePreparedStatement(preparedStatement, errorMessage);
    verify(preparedStatement, times(1)).close();
    verify(loggerMock, times(1)).warn(errorMessage, sqlException);
}