Repository: cayenne
Updated Branches:
  refs/heads/master 82399d539 -> 21ff693b9


fix test SelectActionWithUnsupportedDistinctTypesIT


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/be2db3ea
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/be2db3ea
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/be2db3ea

Branch: refs/heads/master
Commit: be2db3eae0b4c291ad5c87dea6b89d2e5de8db4c
Parents: 01d0b24
Author: Savva Kolbachev <s.kolbac...@gmail.com>
Authored: Fri Dec 19 17:03:11 2014 +0300
Committer: Savva Kolbachev <s.kolbac...@gmail.com>
Committed: Fri Dec 19 17:03:11 2014 +0300

----------------------------------------------------------------------
 ...ectActionWithUnsupportedDistinctTypesIT.java | 22 +++++++++++---------
 1 file changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/be2db3ea/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionWithUnsupportedDistinctTypesIT.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionWithUnsupportedDistinctTypesIT.java
 
b/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionWithUnsupportedDistinctTypesIT.java
index 5a9fc2a..b2f590bb 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionWithUnsupportedDistinctTypesIT.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionWithUnsupportedDistinctTypesIT.java
@@ -34,10 +34,13 @@ import org.junit.Test;
 
 import java.sql.SQLException;
 import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 @UseServerRuntime(CayenneProjects.UNSUPPORTED_DISTINCT_TYPES_PROJECT)
 public class SelectActionWithUnsupportedDistinctTypesIT extends ServerCase {
@@ -110,23 +113,22 @@ public class SelectActionWithUnsupportedDistinctTypesIT 
extends ServerCase {
         List<Product> result = context.performQuery(query);
         assertNotNull(result);
 
-        int i = 0;
         for (Product product : result) {
             List<Product> productsContained = product.getContained();
             assertNotNull(productsContained);
-            assertEquals(i, productsContained.size());
 
             List<Product> productsBase = product.getBase();
             assertNotNull(productsBase);
-            assertEquals(3 - i, productsBase.size());
 
-            i++;
+            assertEquals(3, productsContained.size() + productsBase.size());
         }
     }
 
     @Test
     public void testOrdersSelectManyToManyQuery() throws SQLException {
         createOrdersManyToManyDataSet();
+        List assertSizes = new ArrayList(3);
+        assertSizes.addAll(Arrays.asList(1, 2, 3));
 
         SelectQuery productQuery = new SelectQuery(Product.class);
         productQuery.addPrefetch("orderBy");
@@ -134,13 +136,13 @@ public class SelectActionWithUnsupportedDistinctTypesIT 
extends ServerCase {
         List<Product> productResult = context.performQuery(productQuery);
         assertNotNull(productResult);
 
-        int i = 3;
+        List orderBySizes = new ArrayList(3);
         for (Product product : productResult) {
             List<Customer> orderBy = product.getOrderBy();
             assertNotNull(orderBy);
-            assertEquals(i, orderBy.size());
-            i--;
+            orderBySizes.add(orderBy.size());
         }
+        assertTrue(assertSizes.containsAll(orderBySizes));
 
 
         SelectQuery customerQuery = new SelectQuery(Customer.class);
@@ -149,13 +151,13 @@ public class SelectActionWithUnsupportedDistinctTypesIT 
extends ServerCase {
         List<Customer> customerResult = context.performQuery(customerQuery);
         assertNotNull(customerResult);
 
-        i = 1;
+        List orderSizes = new ArrayList(3);
         for (Customer customer : customerResult) {
             List<Product> orders = customer.getOrder();
             assertNotNull(orders);
-            assertEquals(i, orders.size());
-            i++;
+            orderSizes.add(orders.size());
         }
+        assertTrue(assertSizes.containsAll(orderSizes));
     }
 
 }

Reply via email to