use of com.sun.codemodel.JCodeModel in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesNumber.
@Test
public void applyGeneratesNumber() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "number");
when(config.isUseDoubleNumbers()).thenReturn(true);
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is(Double.class.getName()));
}
use of com.sun.codemodel.JCodeModel in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesBooleanPrimitive.
@Test
public void applyGeneratesBooleanPrimitive() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "boolean");
when(config.isUsePrimitives()).thenReturn(true);
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is("boolean"));
}
use of com.sun.codemodel.JCodeModel in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyChoosesObjectOnUnrecognizedType.
@Test
public void applyChoosesObjectOnUnrecognizedType() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "unknown");
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is(Object.class.getName()));
}
use of com.sun.codemodel.JCodeModel in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeLongPrimitiveWhenMaximumLessThanIntegerMin.
@Test
public void applyGeneratesIntegerUsingJavaTypeLongPrimitiveWhenMaximumLessThanIntegerMin() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "integer");
objectNode.put("maximum", Integer.MIN_VALUE - 1L);
when(config.isUsePrimitives()).thenReturn(true);
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is("long"));
}
use of com.sun.codemodel.JCodeModel in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesBoolean.
@Test
public void applyGeneratesBoolean() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "boolean");
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is(Boolean.class.getName()));
}
Aggregations