Skip to content

Commit 82eeb0d

Browse files
committed
HV-1863 Adjust annotation processor tests
1 parent ed9a42a commit 82eeb0d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

annotation-processor/src/test/java17/org/hibernate/validator/ap/record/RecordConstraintValidationProcessorTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ public void testRecordWithInvalidConstraints() {
4141

4242
assertFalse( compilationResult );
4343

44+
// given the nature of the records, a second error is thrown at line -1:
45+
// "The annotation @FutureOrPresent is disallowed for the return type of this method."
4446
assertThatDiagnosticsMatch(
4547
diagnostics,
48+
new DiagnosticExpectation( Diagnostic.Kind.ERROR, -1 ),
4649
new DiagnosticExpectation( Diagnostic.Kind.ERROR, 15 )
4750
);
4851
}
@@ -85,7 +88,7 @@ public void testRecordWithInvalidMethodConstraints() {
8588

8689
assertThatDiagnosticsMatch(
8790
diagnostics,
88-
new DiagnosticExpectation( Diagnostic.Kind.ERROR, 19 )
91+
new DiagnosticExpectation( Diagnostic.Kind.ERROR, 18 )
8992
);
9093
}
9194
}
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
/*
2-
* Hibernate, Relational Persistence for Idiomatic Java
2+
* Hibernate Validator, declare and validate application constraints
33
*
4-
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
5-
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
4+
* License: Apache License, Version 2.0
5+
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
66
*/
77
package org.hibernate.validator.ap.record;
88

99
import java.util.Date;
1010
import jakarta.validation.constraints.FutureOrPresent;
1111
import jakarta.validation.constraints.NotBlank;
12-
import jakarta.validation.constraints.Positive;
1312

1413
/**
1514
* @author Jan Schatteman
1615
*/
1716
public record RecordWithInvalidMethodConstraints(@NotBlank String string, @FutureOrPresent Date date) {
1817

19-
public void doNothing(@Positive String s) {
18+
public void doNothing(@FutureOrPresent String string) {
2019
//
2120
}
2221
}

0 commit comments

Comments
 (0)