Print actual elements in GraphQlTester

See gh-507
This commit is contained in:
Koen Punt
2022-10-17 11:22:13 +02:00
committed by rstoyanchev
parent f3d07c1bd8
commit da21f7438c
2 changed files with 6 additions and 3 deletions

View File

@@ -563,9 +563,11 @@ final class DefaultGraphQlTester implements GraphQlTester {
public EntityList<E> containsExactly(E... values) {
doAssert(() -> {
List<E> expected = Arrays.asList(values);
List<E> actual = getEntity();
AssertionErrors.assertTrue(
"List at path '" + getPath() + "' should have contained exactly " + expected,
getEntity().equals(expected));
"List at path '" + getPath() + "' should have contained exactly " + expected + ", " +
"but did contain " + actual,
actual.equals(expected));
});
return this;
}

View File

@@ -179,7 +179,8 @@ public class GraphQlTesterTests extends GraphQlTesterTestSupport {
assertThatThrownBy(() -> entityList.containsExactly(leia, han))
.as("Should be exactly the same order")
.hasMessageStartingWith("List at path 'me.friends' should have contained exactly");
.hasMessageStartingWith("List at path 'me.friends' should have contained exactly")
.hasMessageContaining("but did contain ");
response.path("me.friends")
.entityList(new ParameterizedTypeReference<MovieCharacter>() {})