From 694f44b6153cb3cbaffe135615e268a5b5c5fc40 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 4 Jan 2013 14:53:22 +0100 Subject: [PATCH] Fixed indeterministic test case --- .../src/org/jooq/test/_/testcases/DaoTests.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jOOQ-test/src/org/jooq/test/_/testcases/DaoTests.java b/jOOQ-test/src/org/jooq/test/_/testcases/DaoTests.java index c6eed98b0a..97fd241e3d 100644 --- a/jOOQ-test/src/org/jooq/test/_/testcases/DaoTests.java +++ b/jOOQ-test/src/org/jooq/test/_/testcases/DaoTests.java @@ -42,6 +42,9 @@ import static junit.framework.Assert.assertTrue; import static org.jooq.tools.reflect.Reflect.on; import java.sql.Date; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import org.jooq.Record1; @@ -116,8 +119,15 @@ extends BaseTest authors2 = on(TAuthorDao()).call("fetchByLastName", (Object) new String[] { "Orwell", "Coelho"}).>get(); + List authors2 = new ArrayList(on(TAuthorDao()).call("fetchByLastName", (Object) new String[] { "Orwell", "Coelho"}).>get()); assertEquals(2, authors2.size()); + + // Fetched records are not ordered deterministically + Collections.sort(authors2, new Comparator() { + @Override + public int compare(AP o1, AP o2) { + return on(o1).get("id").compareTo(on(o2).get("id")); + }}); assertEquals(1, on(authors2.get(0)).get("id")); assertEquals("George", on(authors2.get(0)).get("firstName")); assertEquals("Orwell", on(authors2.get(0)).get("lastName"));