[#2298] Suppress warnings in generated code (@SuppressWarnings("all")
doesn't work with javac) - Added a test case
This commit is contained in:
parent
2b75918106
commit
2b2675db8d
@ -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,7 +54,10 @@ import org.jooq.maven.example.h2.tables.TAuthor;
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -61,12 +65,23 @@ import org.junit.Test;
|
||||
*/
|
||||
public class TestH2 {
|
||||
|
||||
private static Executor create;
|
||||
private static Connection connection;
|
||||
|
||||
@BeforeClass
|
||||
public static void start() throws Exception {
|
||||
Class.forName("org.h2.Driver");
|
||||
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 {
|
||||
Class.forName("org.h2.Driver");
|
||||
Connection connection = DriverManager.getConnection("jdbc:h2:~/maven-test", "sa", "");
|
||||
Executor create = new Executor(connection, SQLDialect.H2);
|
||||
|
||||
TBook b = T_BOOK.as("b");
|
||||
TAuthor a = T_AUTHOR.as("a");
|
||||
TBookStore s = T_BOOK_STORE.as("s");
|
||||
@ -92,4 +107,12 @@ public class TestH2 {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user