From 55ac86e2a1dfce71807c260c507794148cb8a3db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20T=C3=A1rraga=20Gim=C3=A9nez?= Date: Thu, 10 Oct 2024 11:41:16 +0200 Subject: [PATCH] test: fix JUnit test, #TASK-4974 --- .../datastore/mongodb/MongoDBCollectionTest.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-mongodb/src/test/java/org/opencb/commons/datastore/mongodb/MongoDBCollectionTest.java b/commons-datastore/commons-datastore-mongodb/src/test/java/org/opencb/commons/datastore/mongodb/MongoDBCollectionTest.java index f33b7033c..377d610c5 100644 --- a/commons-datastore/commons-datastore-mongodb/src/test/java/org/opencb/commons/datastore/mongodb/MongoDBCollectionTest.java +++ b/commons-datastore/commons-datastore-mongodb/src/test/java/org/opencb/commons/datastore/mongodb/MongoDBCollectionTest.java @@ -441,15 +441,13 @@ public void testAggregate() { queryResult = mongoDBCollection.aggregate(dbObjectList, new QueryOptions(QueryOptions.LIMIT, 1).append(QueryOptions.SKIP, 0)); assertEquals("There must be 1 results", 1, queryResult.getResults().size()); - assertTrue(queryResult.getResults().contains(result.get(0))); + // As the order of result list change between executions, we must ensure the assertTrue doesn't depend on the order + assertTrue(result.contains(queryResult.getResults().get(0))); queryResult = mongoDBCollection.aggregate(dbObjectList, new QueryOptions(QueryOptions.LIMIT, 1).append(QueryOptions.SKIP, 1)); assertEquals("There must be 1 results", 1, queryResult.getResults().size()); - - System.out.println("result = " + result); - System.out.println("queryResult.getResults() = " + queryResult.getResults()); - - assertTrue(queryResult.getResults().contains(result.get(1))); + // As the order of result list change between executions, we must ensure the assertTrue doesn't depend on the order + assertTrue(result.contains(queryResult.getResults().get(0))); } @Test