Skip to content

Commit 46b4df4

Browse files
thcedclaude
andcommitted
fix: Address code review for NeverSchema validator tests
- Pin the exact NeverSchema failure message with isEqualTo instead of contains - Assert that pointer round-trips into the ValidationError - Assert the rejected value is captured, closing the Task 1 review's require vs fail regression risk Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3486e86 commit 46b4df4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/test/java/com/retailsvc/http/validate/DefaultValidatorDispatchTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,13 @@ void neverSchemaRejectsString() {
8282
t -> {
8383
var err = ((ValidationException) t).error();
8484
assertThat(err.keyword()).isEqualTo("false");
85-
assertThat(err.message()).contains("rejects all values");
85+
assertThat(err.message()).isEqualTo("schema rejects all values");
86+
assertThat(err.pointer()).isEqualTo("/v");
87+
assertThat(err.rejectedValue()).isEqualTo("anything");
8688
});
8789
}
8890

91+
// Full ValidationError surface is verified by neverSchemaRejectsString; these cover keyword only.
8992
@Test
9093
void neverSchemaRejectsInteger() {
9194
assertThatThrownBy(() -> v.validate(42, new NeverSchema(), "/v"))

0 commit comments

Comments
 (0)