Skip to content

Commit 82cd048

Browse files
committed
test: Assert errors array end-to-end for oneOf failures
1 parent 2961549 commit 82cd048

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/test/java/com/retailsvc/http/OpenApiServerIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ void postShapeUnknownKindReturns400() {
437437
assertThat(response.headers().firstValue("Content-Type").orElse(""))
438438
.contains("application/problem+json");
439439
assertThat(response.body()).contains("oneOf");
440+
// Both branches fail at distinct leaves -> two entries, in the errors[] array.
441+
assertThat(response.body()).contains("\"errors\"").contains("#/radius").contains("#/kind");
440442
} catch (IOException e) {
441443
fail(e);
442444
} catch (InterruptedException e) {
@@ -459,6 +461,9 @@ void postShapeMissingDiscriminatorReturns400() {
459461
assertThat(response.headers().firstValue("Content-Type").orElse(""))
460462
.contains("application/problem+json");
461463
assertThat(response.body()).contains("oneOf");
464+
// Both branches fail identically at /kind required -> de-duplicated to one entry.
465+
assertThat(response.body()).contains("\"errors\"").contains("#/kind");
466+
assertThat(response.body().split("#/kind", -1)).hasSize(2); // exactly one occurrence
462467
} catch (IOException e) {
463468
fail(e);
464469
} catch (InterruptedException e) {

0 commit comments

Comments
 (0)