@@ -57,10 +57,9 @@ public void testValidationIsAppliedOnDefinedValue_whenNullValueExtracted() {
5757 Set <ConstraintViolation <UnitIssue3 >> violations = validator .validate (unitIssue );
5858 assertEquals (1 , violations .size ());
5959 }
60-
61- // ensure that JsonNullable<Collection<T>> gets unwrapped and the collection items are validated as well
60+
6261 @ Test
63- public void testUnwrapList () {
62+ public void testCollection () {
6463 Car aCar = new Car ();
6564
6665 // test for java.util.List
@@ -76,7 +75,7 @@ public void testUnwrapList() {
7675 assertEquals (3 , validationResult .size ());
7776 assertTrue (validationResult .stream ().anyMatch (c -> c .getPropertyPath ().toString ().equals ("wheels[1].screws" ) && c .getConstraintDescriptor ().getAnnotation ().annotationType ().getSimpleName ().equals ("NotNull" )));
7877 assertTrue (validationResult .stream ().anyMatch (c -> c .getPropertyPath ().toString ().equals ("wheels[3].screws" ) && c .getConstraintDescriptor ().getAnnotation ().annotationType ().getSimpleName ().equals ("NotNull" )));
79- assertTrue (validationResult .stream ().anyMatch (c -> c .getPropertyPath ().toString ().equals ("persons[0 ].role" ) && c .getConstraintDescriptor ().getAnnotation ().annotationType ().getSimpleName ().equals ("NotNull" )));
78+ assertTrue (validationResult .stream ().anyMatch (c -> c .getPropertyPath ().toString ().equals ("persons[].role" ) && c .getConstraintDescriptor ().getAnnotation ().annotationType ().getSimpleName ().equals ("NotNull" )));
8079 }
8180
8281
@@ -120,10 +119,10 @@ public void setNotNullString(String value) {
120119
121120 private static class Car {
122121 @ Valid
123- private JsonNullable <List <Wheel >> wheels = JsonNullable .undefined ();
122+ private JsonNullable <List <@ Valid Wheel >> wheels = JsonNullable .undefined ();
124123
125124 @ Valid
126- private JsonNullable <Set <Person >> persons = JsonNullable .undefined ();
125+ private JsonNullable <Set <@ Valid Person >> persons = JsonNullable .undefined ();
127126
128127 public void addWheel (Wheel wheel ) {
129128 if (wheels == null || !wheels .isPresent ()) {
0 commit comments