diff --git a/jOOQ-codegen-maven-example/src/test/java/org/jooq/test/util/maven/TestGeneratedSources.java b/jOOQ-codegen-maven-example/src/test/java/org/jooq/test/util/maven/TestGeneratedSources.java index fff1bd2dcd..5ec4cdc662 100644 --- a/jOOQ-codegen-maven-example/src/test/java/org/jooq/test/util/maven/TestGeneratedSources.java +++ b/jOOQ-codegen-maven-example/src/test/java/org/jooq/test/util/maven/TestGeneratedSources.java @@ -46,6 +46,7 @@ import org.jooq.Record; import org.jooq.Result; import org.jooq.util.maven.example.PublicFactory; import org.jooq.util.maven.example.tables.TBook; +import org.jooq.util.maven.example.tables.records.TBookRecord; import org.junit.Test; @@ -58,7 +59,7 @@ public class TestGeneratedSources { private static final List BOOK_TITLES = Arrays.asList("1984", "Animal Farm", "O Alquimista", "Brida"); @Test - public void run() throws Exception { + public void testFetch() throws Exception { Connection connection = DriverManager.getConnection("jdbc:postgresql:postgres", "postgres", "test"); PublicFactory create = new PublicFactory(connection); @@ -71,4 +72,21 @@ public class TestGeneratedSources { assertEquals(BOOK_IDS, books.getValues(0)); assertEquals(BOOK_TITLES, books.getValues(1)); } + + @Test + public void testFetchInto() throws Exception { + Connection connection = DriverManager.getConnection("jdbc:postgresql:postgres", "postgres", "test"); + PublicFactory create = new PublicFactory(connection); + + List books = + create.select(TBook.ID, TBook.TITLE) + .from(TBook.T_BOOK) + .orderBy(TBook.ID) + .fetchInto(TBookRecord.class); + + for (int i = 0; i < BOOK_IDS.size(); i++) { + assertEquals(BOOK_IDS.get(i), books.get(i).getId()); + assertEquals(BOOK_TITLES.get(i), books.get(i).getTitle()); + } + } }