use of com.sun.codemodel.JType in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesNumberUsingJavaTypeDoublePrimitive.
@Test
public void applyGeneratesNumberUsingJavaTypeDoublePrimitive() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "number");
objectNode.put("javaType", "double");
when(config.isUsePrimitives()).thenReturn(false);
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is("double"));
}
use of com.sun.codemodel.JType in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeLongWhenMinimumGreaterThanIntegerMax.
@Test
public void applyGeneratesIntegerUsingJavaTypeLongWhenMinimumGreaterThanIntegerMax() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "integer");
objectNode.put("minimum", Integer.MAX_VALUE + 1L);
when(config.isUsePrimitives()).thenReturn(false);
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is(Long.class.getName()));
}
use of com.sun.codemodel.JType in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesBigDecimal.
@Test
public void applyGeneratesBigDecimal() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "number");
when(config.isUseBigDecimals()).thenReturn(true);
JType result = rule.apply("fooBar", objectNode, jpackage, null);
assertThat(result.fullName(), is(BigDecimal.class.getName()));
}
use of com.sun.codemodel.JType 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.JType 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"));
}
Aggregations