use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeLongPrimitiveWhenMaximumGreaterThanIntegerMax.
@Test
public void applyGeneratesIntegerUsingJavaTypeLongPrimitiveWhenMaximumGreaterThanIntegerMax() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "integer");
objectNode.put("maximum", Integer.MAX_VALUE + 1L);
when(config.isUsePrimitives()).thenReturn(true);
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is("long"));
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeInteger.
@Test
public void applyGeneratesIntegerUsingJavaTypeInteger() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "integer");
objectNode.put("javaType", "java.lang.Integer");
when(config.isUsePrimitives()).thenReturn(true);
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is("java.lang.Integer"));
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.
the class FragmentResolverTest method hashResolvesToRoot.
@Test
public void hashResolvesToRoot() {
ObjectNode root = new ObjectMapper().createObjectNode();
root.set("child1", root.objectNode());
root.set("child2", root.objectNode());
root.set("child3", root.objectNode());
assertThat((ObjectNode) resolver.resolve(root, "#", "#/."), is(sameInstance(root)));
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.
the class FragmentResolverTest method attemptToUsePropertyNameOnArrayNodeThrowsIllegalArgumentException.
@Test(expected = IllegalArgumentException.class)
public void attemptToUsePropertyNameOnArrayNodeThrowsIllegalArgumentException() {
ObjectNode root = new ObjectMapper().createObjectNode();
ArrayNode a = root.arrayNode();
root.set("a", a);
resolver.resolve(root, "#/a/b", "#/.");
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.
the class FragmentResolverTest method missingPathThrowsIllegalArgumentException.
@Test(expected = IllegalArgumentException.class)
public void missingPathThrowsIllegalArgumentException() {
ObjectNode root = new ObjectMapper().createObjectNode();
resolver.resolve(root, "#/a/b/c", "#/.");
}
Aggregations