|
22 | 22 | import org.junit.Assert;
|
23 | 23 | import org.junit.Test;
|
24 | 24 |
|
| 25 | +import java.util.List; |
25 | 26 | import java.util.concurrent.Callable;
|
26 | 27 |
|
27 | 28 | import static org.junit.Assert.assertTrue;
|
@@ -136,9 +137,15 @@ public void multipleViolations() {
|
136 | 137 | Assert.fail("did not throw exception for 3 schema violations");
|
137 | 138 | } catch (ValidationException e) {
|
138 | 139 | Assert.assertEquals(3, e.getCausingExceptions().size());
|
139 |
| - Assert.assertEquals(1, TestSupport.countCauseByJsonPointer(e, "#/numberProp")); |
140 | 140 | Assert.assertEquals(1, TestSupport.countCauseByJsonPointer(e, "#"));
|
| 141 | + Assert.assertEquals(1, TestSupport.countCauseByJsonPointer(e, "#/numberProp")); |
141 | 142 | Assert.assertEquals(1, TestSupport.countCauseByJsonPointer(e, "#/stringPatternMatch"));
|
| 143 | + |
| 144 | + List<String> messages = e.getAllMessages(); |
| 145 | + Assert.assertEquals(3, messages.size()); |
| 146 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#:")); |
| 147 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#/numberProp:")); |
| 148 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#/stringPatternMatch:")); |
142 | 149 | }
|
143 | 150 | }
|
144 | 151 |
|
@@ -186,6 +193,18 @@ public void multipleViolationsNested() throws Exception {
|
186 | 193 | Assert.assertEquals(1, TestSupport.countCauseByJsonPointer(nested2Exception, "#/nested/nested"));
|
187 | 194 | Assert.assertEquals(1, TestSupport.countCauseByJsonPointer(nested2Exception, "#/nested/nested/numberProp"));
|
188 | 195 | Assert.assertEquals(1, TestSupport.countCauseByJsonPointer(nested2Exception, "#/nested/nested/stringPatternMatch"));
|
| 196 | + |
| 197 | + List<String> messages = subjectException.getAllMessages(); |
| 198 | + Assert.assertEquals(9, messages.size()); |
| 199 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#:")); |
| 200 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#/numberProp:")); |
| 201 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#/stringPatternMatch:")); |
| 202 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#/nested:")); |
| 203 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#/nested/numberProp:")); |
| 204 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#/nested/stringPatternMatch:")); |
| 205 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#/nested/nested:")); |
| 206 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#/nested/nested/numberProp:")); |
| 207 | + Assert.assertEquals(1, TestSupport.countMatchingMessage(messages, "#/nested/nested/stringPatternMatch:")); |
189 | 208 | }
|
190 | 209 | }
|
191 | 210 |
|
|
0 commit comments