Ejemplo n.º 1
0
  @Test
  public void test() throws SQLException {

    LOGGER.info("Method test start");
    Throwable got = null;
    try {
      tf0();
    } catch (final Throwable throwable) {
      got = throwable;
    } finally {
      final DataSource dataSource = DataSource.class.cast(context.getBean("dataSource"));
      final Connection connection = dataSource.getConnection();
      final Map<String, Object> resultMap = new HashMap<String, Object>();
      try {
        JDBCHelper.executeQuery("select name from test", connection, resultMap);
      } finally {
        if (connection != null) {
          connection.close();
        }
      }
      AssertJUnit.assertTrue(resultMap.isEmpty());
    }
    AssertJUnit.assertNotNull(got);
    LOGGER.info("Method test end");
  }
Ejemplo n.º 2
0
 public void tf1(final Connection connection) throws SQLException {
   LOGGER.info("Method tf1 start");
   JDBCHelper.execute("insert into test (name) values ('nitin')", connection);
   JDBCHelper.executeQuery("select name from test", connection, new HashMap<String, Object>());
   LOGGER.info("Method tf1 end");
 }