use of com.sun.codemodel.JDocCommentable in project jsonschema2pojo by joelittlejohn.
the class RequiredRuleTest method applyAddsTextWhenRequired.
@Test
public void applyAddsTextWhenRequired() throws JClassAlreadyExistsException {
JDefinedClass jclass = new JCodeModel()._class(TARGET_CLASS_NAME);
ObjectMapper mapper = new ObjectMapper();
BooleanNode descriptionNode = mapper.createObjectNode().booleanNode(true);
JDocCommentable result = rule.apply("fooBar", descriptionNode, jclass, null);
assertThat(result.javadoc(), sameInstance(jclass.javadoc()));
assertThat(result.javadoc().size(), is(1));
assertThat((String) result.javadoc().get(0), is("\n(Required)"));
}
use of com.sun.codemodel.JDocCommentable in project jsonschema2pojo by joelittlejohn.
the class RequiredRuleTest method applySkipsTextWhenNotRequired.
@Test
public void applySkipsTextWhenNotRequired() throws JClassAlreadyExistsException {
JDefinedClass jclass = new JCodeModel()._class(TARGET_CLASS_NAME);
ObjectMapper mapper = new ObjectMapper();
BooleanNode descriptionNode = mapper.createObjectNode().booleanNode(false);
JDocCommentable result = rule.apply("fooBar", descriptionNode, jclass, null);
assertThat(result.javadoc(), sameInstance(jclass.javadoc()));
assertThat(result.javadoc().size(), is(0));
}
Aggregations