[#913] NoClassDefFoundError in JooqUtil.isJPAAvailable()

This commit is contained in:
Lukas Eder 2011-11-09 18:55:54 +00:00
parent 3ef619db26
commit 50d9c31265

View File

@ -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<String> 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<TBookRecord> 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());
}
}
}