diff --git a/annotation-processor/src/test/java17/org/hibernate/validator/ap/record/RecordConstraintValidationProcessorTest.java b/annotation-processor/src/test/java17/org/hibernate/validator/ap/record/RecordConstraintValidationProcessorTest.java index a5ba33e9bd..0f91c71050 100644 --- a/annotation-processor/src/test/java17/org/hibernate/validator/ap/record/RecordConstraintValidationProcessorTest.java +++ b/annotation-processor/src/test/java17/org/hibernate/validator/ap/record/RecordConstraintValidationProcessorTest.java @@ -41,8 +41,11 @@ public void testRecordWithInvalidConstraints() { assertFalse( compilationResult ); + // given the nature of the records, a second error is thrown at line -1: + // "The annotation @FutureOrPresent is disallowed for the return type of this method." assertThatDiagnosticsMatch( diagnostics, + new DiagnosticExpectation( Diagnostic.Kind.ERROR, -1 ), new DiagnosticExpectation( Diagnostic.Kind.ERROR, 15 ) ); } @@ -85,7 +88,7 @@ public void testRecordWithInvalidMethodConstraints() { assertThatDiagnosticsMatch( diagnostics, - new DiagnosticExpectation( Diagnostic.Kind.ERROR, 19 ) + new DiagnosticExpectation( Diagnostic.Kind.ERROR, 18 ) ); } } diff --git a/annotation-processor/src/test/java17/org/hibernate/validator/ap/record/RecordWithInvalidMethodConstraints.java b/annotation-processor/src/test/java17/org/hibernate/validator/ap/record/RecordWithInvalidMethodConstraints.java index 14c8380c66..6a05d23f5c 100644 --- a/annotation-processor/src/test/java17/org/hibernate/validator/ap/record/RecordWithInvalidMethodConstraints.java +++ b/annotation-processor/src/test/java17/org/hibernate/validator/ap/record/RecordWithInvalidMethodConstraints.java @@ -1,22 +1,21 @@ /* - * Hibernate, Relational Persistence for Idiomatic Java + * Hibernate Validator, declare and validate application constraints * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html + * License: Apache License, Version 2.0 + * See the license.txt file in the root directory or . */ package org.hibernate.validator.ap.record; import java.util.Date; import javax.validation.constraints.FutureOrPresent; import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Positive; /** * @author Jan Schatteman */ public record RecordWithInvalidMethodConstraints(@NotBlank String string, @FutureOrPresent Date date) { - public void doNothing(@Positive String s) { + public void doNothing(@FutureOrPresent String string) { // } }