summaryrefslogtreecommitdiff
path: root/myapp/src/test/java/io
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-08-19 19:45:28 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2013-08-19 19:45:28 +0200
commit8cca2127e0e11486cc45ae1a8198bd778301f935 (patch)
treee81daa9d333c4797fd2f14d3170f36fdc1bcbb60 /myapp/src/test/java/io
parente78c0a1e4a4ebc71502dceccc9ae640862b7ce9e (diff)
downloadcontainer-playground-master.tar.gz
container-playground-master.tar.bz2
container-playground-master.tar.xz
container-playground-master.zip
o Dropping the Sequences class. Moving more stuff into SqlUnit to make it easier available in a generic form.HEADmaster
o Fixing the complicated cases where the generation got confused with both setter and constructor injection.
Diffstat (limited to 'myapp/src/test/java/io')
-rw-r--r--myapp/src/test/java/io/trygvis/container/myapp/AddressBookTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/myapp/src/test/java/io/trygvis/container/myapp/AddressBookTest.java b/myapp/src/test/java/io/trygvis/container/myapp/AddressBookTest.java
new file mode 100644
index 0000000..4757b54
--- /dev/null
+++ b/myapp/src/test/java/io/trygvis/container/myapp/AddressBookTest.java
@@ -0,0 +1,26 @@
+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");
+ }
+}