package io.trygvis.container.myapp; import org.testng.annotations.Test; import static org.fest.assertions.Assertions.assertThat; public class AddressBookTest { @Test public void testBasic() throws Exception { String jdbcUrl = "jdbc:h2:mem:address-book;DB_CLOSE_DELAY=-1"; MyAppSqlSessionFactory sessionFactory = new MyAppSqlSessionFactory(new DriverManagerDataSource(jdbcUrl)); MyAppSqlSession session = sessionFactory.newSession(); for (String s : sessionFactory.getUnit().create()) { session.executeUpdate(s); } session.close(); session = sessionFactory.newSession(); session.company.insert(new Company("My Company")); Company company = session.company.selectById(1l); assertThat(company.name).isEqualTo("My Company"); } }