Merge branch '1.2.x'

This commit is contained in:
rstoyanchev
2024-01-30 09:25:13 +00:00
2 changed files with 18 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -296,6 +296,7 @@ final class DefaultGraphQlTester implements GraphQlTester {
@Override
public Path path(String path, Consumer<Path> pathConsumer) {
this.delegate.verifyErrors();
return DefaultPath.forNestedPath(null, path, this.delegate, pathConsumer);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -292,6 +292,21 @@ public class GraphQlTesterTests extends GraphQlTesterTestSupport {
assertThat(getActualRequestDocument()).contains(document);
}
@Test // gh-891
void errorsCheckedOnTraverseWithConsumer() {
String document = "{me {name, friends}}";
getGraphQlService().setError(document, builder -> builder.message("Invalid query"));
assertThatThrownBy(() ->
graphQlTester().document(document)
.execute()
.path("me", it -> it.path("name").hasValue()))
.hasMessageContaining("Response has 1 unexpected error(s)");
assertThat(getActualRequestDocument()).contains(document);
}
@Test
void errorsPartiallyFiltered() {