Skip to content

Commit e336a36

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 3591b6c commit e336a36

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
@@ -204,10 +204,13 @@ void neverSchemaRejectsString() {
204204
t -> {
205205
var err = ((ValidationException) t).error();
206206
assertThat(err.keyword()).isEqualTo("false");
207-
assertThat(err.message()).contains("rejects all values");
207+
assertThat(err.message()).isEqualTo("schema rejects all values");
208+
assertThat(err.pointer()).isEqualTo("/v");
209+
assertThat(err.rejectedValue()).isEqualTo("anything");
208210
});
209211
}
210212

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

0 commit comments

Comments
 (0)