|
24 | 24 | import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
25 | 25 | import com.fasterxml.jackson.databind.node.ObjectNode;
|
26 | 26 | import com.github.fge.jackson.JacksonUtils;
|
| 27 | +import com.github.fge.jackson.JsonLoader; |
27 | 28 | import com.github.fge.jackson.NodeType;
|
28 | 29 | import com.github.fge.jsonschema.cfg.ValidationConfiguration;
|
29 | 30 | import com.github.fge.jsonschema.core.exceptions.ProcessingException;
|
|
39 | 40 | import com.github.fge.jsonschema.library.Keyword;
|
40 | 41 | import com.github.fge.jsonschema.library.Library;
|
41 | 42 | import com.github.fge.jsonschema.main.JsonSchemaFactory;
|
| 43 | +import com.github.fge.jsonschema.main.JsonValidator; |
42 | 44 | import com.github.fge.jsonschema.processors.data.FullData;
|
43 | 45 | import com.github.fge.msgsimple.bundle.MessageBundle;
|
44 | 46 | import org.testng.annotations.BeforeMethod;
|
45 | 47 | import org.testng.annotations.Test;
|
46 | 48 |
|
| 49 | +import java.io.IOException; |
47 | 50 | import java.util.concurrent.atomic.AtomicInteger;
|
48 | 51 |
|
49 |
| -import static org.mockito.Mockito.*; |
50 |
| -import static org.testng.Assert.*; |
| 52 | +import static org.mockito.Mockito.mock; |
| 53 | +import static org.testng.Assert.assertEquals; |
| 54 | +import static org.testng.Assert.assertTrue; |
51 | 55 |
|
52 | 56 | public final class ValidationProcessorTest
|
53 | 57 | {
|
@@ -111,6 +115,19 @@ public void childrenAreExploredOnDemandEvenIfContainerFails()
|
111 | 115 | assertEquals(COUNT.get(), 1);
|
112 | 116 | }
|
113 | 117 |
|
| 118 | + @Test(timeOut = 1000) |
| 119 | + public void circularReferencingDuringValidationIsDetected() |
| 120 | + throws IOException, ProcessingException |
| 121 | + { |
| 122 | + final JsonNode schemaNode |
| 123 | + = JsonLoader.fromResource("/other/issue102.json"); |
| 124 | + final JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); |
| 125 | + final JsonValidator validator = factory.getValidator(); |
| 126 | + |
| 127 | + validator.validate(schemaNode, JacksonUtils.nodeFactory().nullNode()); |
| 128 | + assertTrue(true); |
| 129 | + } |
| 130 | + |
114 | 131 | public static final class K1Validator
|
115 | 132 | extends AbstractKeywordValidator
|
116 | 133 | {
|
|
0 commit comments