-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HV-1715 Accumulate validationSuccessful attribute
- validationSuccessful attribute was ignored and only a value from the last group was considered. Which could lead HV to proceed to the next group even though there was a violation for one of the inherited groups of the current one.
- Loading branch information
1 parent
8fc4263
commit e718f8f
Showing
2 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
.../test/java/org/hibernate/validator/test/internal/engine/groups/sequence/SequenceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Hibernate Validator, declare and validate application constraints | ||
* | ||
* License: Apache License, Version 2.0 | ||
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>. | ||
*/ | ||
package org.hibernate.validator.test.internal.engine.groups.sequence; | ||
|
||
import static org.hibernate.validator.testutil.ConstraintViolationAssert.assertThat; | ||
import static org.hibernate.validator.testutil.ConstraintViolationAssert.violationOf; | ||
|
||
import java.util.Set; | ||
|
||
import javax.validation.ConstraintViolation; | ||
import javax.validation.GroupSequence; | ||
import javax.validation.Validator; | ||
import javax.validation.constraints.NotNull; | ||
|
||
import org.hibernate.validator.testutil.TestForIssue; | ||
import org.hibernate.validator.testutils.ValidatorUtil; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* @author Marko Bekhta | ||
*/ | ||
@TestForIssue( jiraKey = "HV-1715") | ||
public class SequenceTest { | ||
|
||
@Test | ||
public void groupSequenceOfGroupSequences() { | ||
Validator validator = ValidatorUtil.getValidator(); | ||
|
||
Set<ConstraintViolation<Foo>> violations = validator.validate( new Foo( null, "", null ) ); | ||
|
||
assertThat( violations ).containsOnlyViolations( | ||
violationOf( NotNull.class ).withProperty( "str1" ) | ||
); | ||
} | ||
|
||
interface Group1 extends Group11, Group12, Group13, Group14, Group15, Group16, Group17, Group18, Group19 { | ||
} | ||
|
||
interface Group11 { | ||
} | ||
|
||
interface Group12 { | ||
} | ||
|
||
interface Group13 { | ||
} | ||
|
||
interface Group14 { | ||
} | ||
|
||
interface Group15 { | ||
} | ||
|
||
interface Group16 { | ||
} | ||
|
||
interface Group17 { | ||
} | ||
|
||
interface Group18 { | ||
} | ||
|
||
interface Group19 { | ||
} | ||
|
||
interface Group2 { | ||
} | ||
|
||
@GroupSequence({ Foo.class, SequenceTest.Group1.class, SequenceTest.Group2.class }) | ||
private static class Foo { | ||
@NotNull(groups = SequenceTest.Group11.class) | ||
private String str1; | ||
@NotNull(groups = SequenceTest.Group12.class) | ||
private String str2; | ||
@NotNull(groups = SequenceTest.Group2.class) | ||
private String str3; | ||
|
||
public Foo(String str1, String str2, String str3) { | ||
this.str1 = str1; | ||
this.str2 = str2; | ||
this.str3 = str3; | ||
} | ||
} | ||
} |