Search in sources :

Example 11 with JavaField

use of com.thoughtworks.qdox.model.JavaField in project jsonschema2pojo by joelittlejohn.

the class TitleIT method titleAppearsBeforeDescriptionInJavadoc.

@Test
public void titleAppearsBeforeDescriptionInJavadoc() {
    JavaField javaField = classWithTitle.getFieldByName("titleAndDescription");
    String javaDocComment = javaField.getComment();
    assertThat(javaDocComment, containsString("A description for this property"));
    assertThat(javaDocComment.indexOf("A title for this property"), is(lessThan(javaDocComment.indexOf("A description for this property"))));
}
Also used : JavaField(com.thoughtworks.qdox.model.JavaField) Test(org.junit.Test)

Example 12 with JavaField

use of com.thoughtworks.qdox.model.JavaField in project jsonschema2pojo by joelittlejohn.

the class DollarCommentIT method dollarCommentAppearsInFieldJavadoc.

@Test
public void dollarCommentAppearsInFieldJavadoc() {
    JavaField javaField = classWithDescription.getFieldByName("withComment");
    String javaDocComment = javaField.getComment();
    assertThat(javaDocComment, containsString("JavaDoc linking to {@link #descriptionAndComment}"));
}
Also used : JavaField(com.thoughtworks.qdox.model.JavaField) Test(org.junit.Test)

Example 13 with JavaField

use of com.thoughtworks.qdox.model.JavaField in project jsonschema2pojo by joelittlejohn.

the class JavaNameIT method arrayRequiredAppearsInFieldJavadoc.

@Test
public void arrayRequiredAppearsInFieldJavadoc() throws IOException {
    schemaRule.generateAndCompile("/schema/javaName/javaNameWithRequiredProperties.json", "com.example.required");
    File generatedJavaFileWithRequiredProperties = schemaRule.generated("com/example/required/JavaNameWithRequiredProperties.java");
    JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
    javaDocBuilder.addSource(generatedJavaFileWithRequiredProperties);
    JavaClass classWithRequiredProperties = javaDocBuilder.getClassByName("com.example.required.JavaNameWithRequiredProperties");
    JavaField javaFieldWithoutJavaName = classWithRequiredProperties.getFieldByName("requiredPropertyWithoutJavaName");
    JavaField javaFieldWithJavaName = classWithRequiredProperties.getFieldByName("requiredPropertyWithoutJavaName");
    assertThat(javaFieldWithoutJavaName.getComment(), containsString("(Required)"));
    assertThat(javaFieldWithJavaName.getComment(), containsString("(Required)"));
}
Also used : JavaField(com.thoughtworks.qdox.model.JavaField) JavaClass(com.thoughtworks.qdox.model.JavaClass) File(java.io.File) JavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder) Test(org.junit.Test)

Example 14 with JavaField

use of com.thoughtworks.qdox.model.JavaField in project jsonschema2pojo by joelittlejohn.

the class JavaNameIT method inlineRequiredAppearsInFieldJavadoc.

@Test
public void inlineRequiredAppearsInFieldJavadoc() throws IOException {
    schemaRule.generateAndCompile("/schema/javaName/javaNameWithRequiredProperties.json", "com.example.required");
    File generatedJavaFileWithRequiredProperties = schemaRule.generated("com/example/required/JavaNameWithRequiredProperties.java");
    JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
    javaDocBuilder.addSource(generatedJavaFileWithRequiredProperties);
    JavaClass classWithRequiredProperties = javaDocBuilder.getClassByName("com.example.required.JavaNameWithRequiredProperties");
    JavaField javaFieldWithoutJavaName = classWithRequiredProperties.getFieldByName("inlineRequiredPropertyWithoutJavaName");
    JavaField javaFieldWithJavaName = classWithRequiredProperties.getFieldByName("inlineRequiredPropertyWithoutJavaName");
    assertThat(javaFieldWithoutJavaName.getComment(), containsString("(Required)"));
    assertThat(javaFieldWithJavaName.getComment(), containsString("(Required)"));
}
Also used : JavaField(com.thoughtworks.qdox.model.JavaField) JavaClass(com.thoughtworks.qdox.model.JavaClass) File(java.io.File) JavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder) Test(org.junit.Test)

Example 15 with JavaField

use of com.thoughtworks.qdox.model.JavaField in project jsonschema2pojo by joelittlejohn.

the class RequiredIT method requiredAppearsInFieldJavadoc.

@Test
public void requiredAppearsInFieldJavadoc() {
    JavaField javaField = classWithRequired.getFieldByName("requiredProperty");
    String javaDocComment = javaField.getComment();
    assertThat(javaDocComment, containsString("(Required)"));
}
Also used : JavaField(com.thoughtworks.qdox.model.JavaField) Test(org.junit.Test)

Aggregations

JavaField (com.thoughtworks.qdox.model.JavaField)17 Test (org.junit.Test)15 File (java.io.File)5 JavaDocBuilder (com.thoughtworks.qdox.JavaDocBuilder)3 JavaClass (com.thoughtworks.qdox.model.JavaClass)3 JavaMethod (com.thoughtworks.qdox.model.JavaMethod)2 BufferedReader (java.io.BufferedReader)2 StringReader (java.io.StringReader)2 StringWriter (java.io.StringWriter)2 JavaConstructor (com.thoughtworks.qdox.model.JavaConstructor)1