Search in sources :

Example 1 with AbstractInheritableJavaEntity

use of com.thoughtworks.qdox.model.AbstractInheritableJavaEntity in project maven-plugins by apache.

the class AbstractFixJavadocMojoTest method testReplaceLinkTags_spacesAfterMethod.

public void testReplaceLinkTags_spacesAfterMethod() throws Throwable {
    String comment = "/** {@link ConnectException#getMessage()       } */";
    AbstractInheritableJavaEntity entity = spy(new PrivateAbstractInheritableJavaEntity());
    JavaClass clazz = mock(JavaClass.class);
    when(entity.getParentClass()).thenReturn(clazz);
    when(clazz.resolveType("ConnectException")).thenReturn("java.net.ConnectException");
    String newComment = (String) PrivateAccessor.invoke(AbstractFixJavadocMojo.class, "replaceLinkTags", new Class[] { String.class, AbstractInheritableJavaEntity.class }, new Object[] { comment, entity });
    assertEquals("/** {@link java.net.ConnectException#getMessage()} */", newComment);
}
Also used : JavaClass(com.thoughtworks.qdox.model.JavaClass) JavaClass(com.thoughtworks.qdox.model.JavaClass) AbstractInheritableJavaEntity(com.thoughtworks.qdox.model.AbstractInheritableJavaEntity)

Example 2 with AbstractInheritableJavaEntity

use of com.thoughtworks.qdox.model.AbstractInheritableJavaEntity in project maven-plugins by apache.

the class AbstractFixJavadocMojoTest method testReplaceLinkTags_spacesAfterLinkTag.

public void testReplaceLinkTags_spacesAfterLinkTag() throws Throwable {
    String comment = "/** {@link     ConnectException} */";
    AbstractInheritableJavaEntity entity = spy(new PrivateAbstractInheritableJavaEntity());
    JavaClass clazz = mock(JavaClass.class);
    when(entity.getParentClass()).thenReturn(clazz);
    when(clazz.resolveType("ConnectException")).thenReturn("java.net.ConnectException");
    String newComment = (String) PrivateAccessor.invoke(AbstractFixJavadocMojo.class, "replaceLinkTags", new Class[] { String.class, AbstractInheritableJavaEntity.class }, new Object[] { comment, entity });
    assertEquals("/** {@link java.net.ConnectException} */", newComment);
}
Also used : JavaClass(com.thoughtworks.qdox.model.JavaClass) JavaClass(com.thoughtworks.qdox.model.JavaClass) AbstractInheritableJavaEntity(com.thoughtworks.qdox.model.AbstractInheritableJavaEntity)

Example 3 with AbstractInheritableJavaEntity

use of com.thoughtworks.qdox.model.AbstractInheritableJavaEntity in project maven-plugins by apache.

the class AbstractFixJavadocMojoTest method testReplaceLinkTags_missingEndBrace.

public void testReplaceLinkTags_missingEndBrace() throws Throwable {
    String comment = "/** {@link ConnectException */";
    AbstractInheritableJavaEntity entity = spy(new PrivateAbstractInheritableJavaEntity());
    JavaClass clazz = mock(JavaClass.class);
    when(entity.getParentClass()).thenReturn(clazz);
    when(clazz.resolveType("ConnectException")).thenReturn("java.net.ConnectException");
    String newComment = (String) PrivateAccessor.invoke(AbstractFixJavadocMojo.class, "replaceLinkTags", new Class[] { String.class, AbstractInheritableJavaEntity.class }, new Object[] { comment, entity });
    assertEquals("/** {@link ConnectException */", newComment);
}
Also used : JavaClass(com.thoughtworks.qdox.model.JavaClass) JavaClass(com.thoughtworks.qdox.model.JavaClass) AbstractInheritableJavaEntity(com.thoughtworks.qdox.model.AbstractInheritableJavaEntity)

Example 4 with AbstractInheritableJavaEntity

use of com.thoughtworks.qdox.model.AbstractInheritableJavaEntity in project maven-plugins by apache.

the class AbstractFixJavadocMojoTest method testReplaceLinkTags_spacesAfterClassName.

public void testReplaceLinkTags_spacesAfterClassName() throws Throwable {
    String comment = "/** {@link ConnectException       } */";
    AbstractInheritableJavaEntity entity = spy(new PrivateAbstractInheritableJavaEntity());
    JavaClass clazz = mock(JavaClass.class);
    when(entity.getParentClass()).thenReturn(clazz);
    when(clazz.resolveType("ConnectException")).thenReturn("java.net.ConnectException");
    String newComment = (String) PrivateAccessor.invoke(AbstractFixJavadocMojo.class, "replaceLinkTags", new Class[] { String.class, AbstractInheritableJavaEntity.class }, new Object[] { comment, entity });
    assertEquals("/** {@link java.net.ConnectException} */", newComment);
}
Also used : JavaClass(com.thoughtworks.qdox.model.JavaClass) JavaClass(com.thoughtworks.qdox.model.JavaClass) AbstractInheritableJavaEntity(com.thoughtworks.qdox.model.AbstractInheritableJavaEntity)

Example 5 with AbstractInheritableJavaEntity

use of com.thoughtworks.qdox.model.AbstractInheritableJavaEntity in project maven-plugins by apache.

the class AbstractFixJavadocMojoTest method testReplaceLinkTags_twoLinks.

public void testReplaceLinkTags_twoLinks() throws Throwable {
    String comment = "/** Use {@link ConnectException} instead of {@link Exception} */";
    AbstractInheritableJavaEntity entity = spy(new PrivateAbstractInheritableJavaEntity());
    JavaClass clazz = mock(JavaClass.class);
    when(entity.getParentClass()).thenReturn(clazz);
    when(clazz.resolveType("ConnectException")).thenReturn("java.net.ConnectException");
    when(clazz.resolveType("Exception")).thenReturn("java.lang.Exception");
    String newComment = (String) PrivateAccessor.invoke(AbstractFixJavadocMojo.class, "replaceLinkTags", new Class[] { String.class, AbstractInheritableJavaEntity.class }, new Object[] { comment, entity });
    assertEquals("/** Use {@link java.net.ConnectException} instead of {@link java.lang.Exception} */", newComment);
}
Also used : JavaClass(com.thoughtworks.qdox.model.JavaClass) JavaClass(com.thoughtworks.qdox.model.JavaClass) AbstractInheritableJavaEntity(com.thoughtworks.qdox.model.AbstractInheritableJavaEntity)

Aggregations

AbstractInheritableJavaEntity (com.thoughtworks.qdox.model.AbstractInheritableJavaEntity)10 JavaClass (com.thoughtworks.qdox.model.JavaClass)10