Search in sources :

Example 6 with AbstractInheritableJavaEntity

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

the class AbstractFixJavadocMojoTest method testReplaceLinkTags_containingHash.

public void testReplaceLinkTags_containingHash() 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 7 with AbstractInheritableJavaEntity

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

the class AbstractFixJavadocMojoTest method testReplaceLinkTags_oneLinkTag.

public void testReplaceLinkTags_oneLinkTag() 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 8 with AbstractInheritableJavaEntity

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

the class AbstractFixJavadocMojoTest method testReplaceLinkTags_OnlyAnchor.

public void testReplaceLinkTags_OnlyAnchor() throws Throwable {
    String comment = "/** There's a {@link #getClass()} but no setClass() */";
    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("/** There's a {@link #getClass()} but no setClass() */", newComment);
}
Also used : JavaClass(com.thoughtworks.qdox.model.JavaClass) JavaClass(com.thoughtworks.qdox.model.JavaClass) AbstractInheritableJavaEntity(com.thoughtworks.qdox.model.AbstractInheritableJavaEntity)

Example 9 with AbstractInheritableJavaEntity

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

the class AbstractFixJavadocMojoTest method testReplaceLinkTags_noLinkTag.

public void testReplaceLinkTags_noLinkTag() throws Throwable {
    String comment = "/** @see 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("/** @see ConnectException */", newComment);
}
Also used : JavaClass(com.thoughtworks.qdox.model.JavaClass) JavaClass(com.thoughtworks.qdox.model.JavaClass) AbstractInheritableJavaEntity(com.thoughtworks.qdox.model.AbstractInheritableJavaEntity)

Example 10 with AbstractInheritableJavaEntity

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

the class AbstractFixJavadocMojoTest method testReplaceLinkTags_followedByHash.

public void testReplaceLinkTags_followedByHash() throws Throwable {
    String comment = "/** {@link ConnectException} ##important## */";
    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} ##important## */", 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