Skip to content

Commit b762667

Browse files
committed
Test
1 parent 07b9001 commit b762667

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package org.hibernate.validator.test.constraints.annotations.hv;
2+
3+
import java.util.List;
4+
import java.util.Map;
5+
import java.util.Set;
6+
7+
import org.hibernate.validator.test.constraints.annotations.AbstractConstrainedTest;
8+
9+
import org.testng.annotations.Test;
10+
11+
import jakarta.validation.Valid;
12+
13+
public class ValidAnnotationTest extends AbstractConstrainedTest {
14+
15+
@Test
16+
public void listAsContainer() {
17+
class Foo {
18+
19+
@Valid
20+
private List<@Valid String> prop;
21+
22+
public Foo(List<String> prop) {
23+
this.prop = prop;
24+
}
25+
}
26+
27+
Foo foo = new Foo(List.of("K1"));
28+
validator.validate(foo);
29+
}
30+
31+
@Test
32+
public void setAsContainer() {
33+
class Foo {
34+
35+
@Valid
36+
private Set<@Valid String> prop;
37+
38+
public Foo(Set<String> prop) {
39+
this.prop = prop;
40+
}
41+
}
42+
43+
Foo foo = new Foo(Set.of("K1"));
44+
validator.validate(foo);
45+
}
46+
47+
@Test
48+
public void mapAsContainer() {
49+
class Foo {
50+
51+
@Valid
52+
private Map<String, @Valid String> prop;
53+
54+
public Foo(Map<String, String> prop) {
55+
this.prop = prop;
56+
}
57+
}
58+
59+
Foo foo = new Foo(Map.of("K1", "V1"));
60+
validator.validate(foo);
61+
}
62+
}

engine/src/test/resources/log4j2.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# License: Apache License, Version 2.0
22
# See the LICENSE file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
3-
rootLogger.level = error
3+
rootLogger.level = warn
44
rootLogger.appenderRefs = console
55
rootLogger.appenderRef.console.ref = console
66

0 commit comments

Comments
 (0)