Skip to content

Commit

Permalink
#431 - GraphQlIT tests are too strict
Browse files Browse the repository at this point in the history
* Suggest not to check for strict number of results, but checking there's at least one result
  • Loading branch information
gknobloch committed Oct 26, 2023
1 parent 46392bc commit bd3ec6d
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.net.URISyntaxException;
import java.util.HashMap;
Expand Down Expand Up @@ -102,7 +103,7 @@ public void testQuery() {
assertNotNull(articleList);
JsonNode articleListItems = articleList.get("items");
assertNotNull(articleListItems);
assertEquals(7, articleListItems.size());
assertTrue(articleListItems.size() > 0);
assertNotNull(articleListItems.get(0).get("_path"));
assertNotNull(articleListItems.get(0).get("authorFragment"));
}
Expand Down Expand Up @@ -169,7 +170,7 @@ public void testQueryWithParameters() {
assertNotNull(articleList);
JsonNode articleListItems = articleList.get("items");
assertNotNull(articleListItems);
assertEquals(1, articleListItems.size());
assertTrue(articleListItems.size() > 0);
assertEquals(TEST_AUTHOR_FIRST_NAME, articleListItems.get(0).get("authorFragment").get("firstName").asText());
assertEquals(TEST_AUTHOR_LAST_NAME, articleListItems.get(0).get("authorFragment").get("lastName").asText());
}
Expand All @@ -185,7 +186,7 @@ public void testPersistedQuery() {
assertNotNull(adventureListList);
JsonNode adventureListItems = adventureListList.get("items");
assertNotNull(adventureListItems);
assertEquals(16, adventureListItems.size());
assertTrue(adventureListItems.size() > 0);
JsonNode firstAdventureItem = adventureListItems.get(0);
assertNotNull(firstAdventureItem.get("_path"));
assertNotNull(firstAdventureItem.get("title"));
Expand Down

0 comments on commit bd3ec6d

Please sign in to comment.