use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesBigIntegerOverridingLong.
@Test
public void applyGeneratesBigIntegerOverridingLong() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "integer");
// isUseBigIntegers should override isUseLongIntegers
when(config.isUseBigIntegers()).thenReturn(true);
when(config.isUseLongIntegers()).thenReturn(true);
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is(BigInteger.class.getName()));
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesNumberPrimitive.
@Test
public void applyGeneratesNumberPrimitive() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "number");
when(config.isUsePrimitives()).thenReturn(true);
when(config.isUseDoubleNumbers()).thenReturn(true);
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is("double"));
}
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)));
}
Aggregations