Permalink
Browse files

[#2298] Suppress warnings in generated code (@SuppressWarnings("all")

doesn't work with javac) - Added a test case
  • Loading branch information...
1 parent 2b75918 commit 2b2675db8d1e3486d5237b55c8d48ff36a63fa88 @lukaseder lukaseder committed Mar 3, 2013
@@ -32,7 +32,7 @@
<type>jar</type>
<scope>test</scope>
</dependency>
-
+
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
@@ -35,6 +35,7 @@
*/
package org.jooq.test.util.maven;
+import static java.util.Arrays.asList;
import static junit.framework.Assert.assertEquals;
import static org.jooq.impl.Factory.countDistinct;
import static org.jooq.maven.example.h2.Tables.T_AUTHOR;
@@ -53,20 +54,34 @@
import org.jooq.maven.example.h2.tables.TBook;
import org.jooq.maven.example.h2.tables.TBookStore;
import org.jooq.maven.example.h2.tables.TBookToBookStore;
+import org.jooq.maven.example.h2.tables.records.TBookRecord;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
* @author Lukas Eder
*/
public class TestH2 {
- @Test
- public void testInstanceModel() throws Exception {
+ private static Executor create;
+ private static Connection connection;
+
+ @BeforeClass
+ public static void start() throws Exception {
Class.forName("org.h2.Driver");
- Connection connection = DriverManager.getConnection("jdbc:h2:~/maven-test", "sa", "");
- Executor create = new Executor(connection, SQLDialect.H2);
+ connection = DriverManager.getConnection("jdbc:h2:~/maven-test", "sa", "");
+ create = new Executor(connection, SQLDialect.H2);
+ }
+
+ @AfterClass
+ public static void stop() throws Exception {
+ connection.close();
+ }
+ @Test
+ public void testInstanceModel() throws Exception {
TBook b = T_BOOK.as("b");
TAuthor a = T_AUTHOR.as("a");
TBookStore s = T_BOOK_STORE.as("s");
@@ -92,4 +107,12 @@ public void testInstanceModel() throws Exception {
assertEquals(Integer.valueOf(3), result.getValue(0, countDistinct(s.NAME)));
assertEquals(Integer.valueOf(2), result.getValue(1, countDistinct(s.NAME)));
}
+
+ @Test
+ public void testTypedRecords() throws Exception {
+ Result<TBookRecord> result = create.selectFrom(T_BOOK).orderBy(T_BOOK.ID).fetch();
+
+ assertEquals(4, result.size());
+ assertEquals(asList(1, 2, 3, 4), result.getValues(0));
+ }
}

0 comments on commit 2b2675d

Please sign in to comment.