Hi experts,
I've got a question regarding the re-definition of default group sequences in inheritance hierarchies, more specifically about the test method GroupSequenceIsolationTest#testCorrectDefaultSequenceInheritance3() in the TCK [1].
There are the following two classes and validation groups defined:
@GroupSequence({ Minimal.class, A.class })
public class A {
@Max(value = 10, groups = Minimal.class)
int size;
@Size(max = 20)
String name; //A group
}
interface Minimal {}
interface Heavy {}
public class B3 extends A {
@SafeEncryption(groups = Heavy.class)
String encryptionKey;
@Size(max = 20)
String nickname;
}
The test looks like this:
B3 b = new B3();
//all values invalid
b.name = "this name is too long";
b.nickname = "and this nickname as well";
b.size = 20;
b.encryptionKey = "not safe";
Set<ConstraintViolation<B3>> violations = validator.validate( b );
assertCorrectNumberOfViolations( violations, 2 );
assertCorrectConstraintTypes( violations, Max.class, Size.class );
assertCorrectPropertyPaths( violations, "size", "nickname" );
So, based on the assertions, the re-defined default group sequence only applies to the constraints defined on A but not on those defined on B3.