use of com.sun.codemodel.JCodeModel in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeIntegerPrimitive.
@Test
public void applyGeneratesIntegerUsingJavaTypeIntegerPrimitive() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "integer");
objectNode.put("existingJavaType", "int");
when(config.isUsePrimitives()).thenReturn(false);
JType result = rule.apply("fooBar", objectNode, null, jpackage, null);
assertThat(result.fullName(), is("int"));
}
use of com.sun.codemodel.JCodeModel 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, null, jpackage, null);
assertThat(result.fullName(), is("double"));
}
use of com.sun.codemodel.JCodeModel in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesNumberUsingJavaTypeBigDecimal.
@Test
public void applyGeneratesNumberUsingJavaTypeBigDecimal() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "number");
objectNode.put("existingJavaType", "java.math.BigDecimal");
JType result = rule.apply("fooBar", objectNode, null, jpackage, null);
assertThat(result.fullName(), is("java.math.BigDecimal"));
}
use of com.sun.codemodel.JCodeModel in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesIntegerPrimitive.
@Test
public void applyGeneratesIntegerPrimitive() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "integer");
when(config.isUsePrimitives()).thenReturn(true);
JType result = rule.apply("fooBar", objectNode, null, jpackage, null);
assertThat(result.fullName(), is("int"));
}
use of com.sun.codemodel.JCodeModel in project jsonschema2pojo by joelittlejohn.
the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeBigInteger.
@Test
public void applyGeneratesIntegerUsingJavaTypeBigInteger() {
JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
ObjectNode objectNode = new ObjectMapper().createObjectNode();
objectNode.put("type", "integer");
objectNode.put("existingJavaType", "java.math.BigInteger");
JType result = rule.apply("fooBar", objectNode, null, jpackage, null);
assertThat(result.fullName(), is("java.math.BigInteger"));
}
Aggregations