This topic has not yet been written. The content below is from the topic description.
2.3.1. Group sequences By default, constraints are evaluated in no particular order and this regardless of which groups they belong to. In some situations, however, it is useful to control the order of the constraints evaluation. In our example from Section 2.3, “Validating groups” we could for example require that first all default car constraints are passing before we check the road worthiness of the car. Finally before we drive away we check the actual driver constraints. In order to implement such an order one would define a new interface and annotate it with @GroupSequence defining the order in which the groups have to be validated. Note If at least one constraints fails in a sequenced group none of the constraints of the following groups in the sequence get validated. Example 2.17. Interface with @GroupSequence @GroupSequence({Default.class, CarChecks.class, DriverChecks.class}) public interface OrderedChecks { } Warning Groups defining a sequence and groups composing a sequence must not be involved in a cyclic dependency either directly or indirectly, either through cascaded sequence definition or group inheritance. If a group containing such a circularity is evaluated, a GroupDefinitionException is raised. The usage of the new sequence could then look like in Example 2.18, “Usage of a group sequence”. Example 2.18. Usage of a group sequence @Test public void testOrderedChecks() { Car car = new Car( "Morris", "DD-AB-123", 2 ); car.setPassedVehicleInspection( true ); Driver john = new Driver( "John Doe" ); john.setAge( 18 ); john.passedDrivingTest( true ); car.setDriver( john ); assertEquals( 0, validator.validate( car, OrderedChecks.class ).size() ); }