Improve readability of assertion messages

Closes gh-361
This commit is contained in:
rstoyanchev
2022-04-28 20:41:05 +01:00
parent d781ec1fe8
commit 5d282fd99e
2 changed files with 7 additions and 1 deletions

View File

@@ -152,6 +152,11 @@ public class DefaultExecutionGraphQlResponse extends AbstractGraphQlResponse imp
return (this.delegate.getExtensions() != null ? this.delegate.getExtensions() : Collections.emptyMap());
}
@Override
public String toString() {
return this.delegate.toString();
}
}

View File

@@ -205,7 +205,8 @@ public class GraphQlClientTests extends GraphQlClientTestSupport {
assertThat(nameField.getError().getParsedPath()).containsExactly("me", "name");
assertThatThrownBy(() -> nameField.toEntity(String.class))
.as("Decoding field null with direct field error should be rejected")
.isInstanceOf(FieldAccessException.class);
.isInstanceOf(FieldAccessException.class)
.hasMessageContaining("Test error");
ClientResponseField nonExistingField = response.field("me.name.other");
assertThat(nonExistingField.hasValue()).isFalse();