dcsimg
running JavaDoc on JUnit test classes
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Coolcat_Jumpman
Posted On:   Saturday, July 12, 2008 09:35 AM

Hi, I'm new to JUnit, so I'm sure I do something wrong here: First I have a simple TestCase: package org.jivesoftware.openfire.plugin.raptor.junit; import org.junit.*; import junit.framework.TestCase; import static org.junit.Assert.*; import org.jivesoftware.openfire.plugin.raptor.*; import static org.jivesoftware.openfire.plugin.raptor.client.Constants.*; import org.xmpp.packet.*; public class TestCheckAddress extends TestCase { /* ... */ @Test public void testToBareJID() { PacketData pd; CheckAddress ca = new CheckAddress(EAT_ANY, null, EAT_BAREJID, "node@example.tld", false); pd = cre   More>>

Hi,
I'm new to JUnit, so I'm sure I do something wrong here:

First I have a simple TestCase:

			package org.jivesoftware.openfire.plugin.raptor.junit;
			

import org.junit.*;
import junit.framework.TestCase;
import static org.junit.Assert.*;

import org.jivesoftware.openfire.plugin.raptor.*;
import static org.jivesoftware.openfire.plugin.raptor.client.Constants.*;
import org.xmpp.packet.*;

public class TestCheckAddress extends TestCase {

/* ... */

@Test
public void testToBareJID() {
PacketData pd;
CheckAddress ca = new CheckAddress(EAT_ANY, null, EAT_BAREJID, "node@example.tld", false);

pd = createPD("other@example.tld", "node@example.tld");
assertTrue(ca.doCheck(pd));

pd = createPD("node@example.tld", "other@example.tld");
assertFalse(ca.doCheck(pd));
}

/* ... */
}


Now I want to document this class using JavaDoc, but when running JavaDoc I always get this exception:
			java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc
			
at com.sun.tools.javadoc.AnnotationDescImpl.annotationType(AnnotationDescImpl.java:46)
at com.sun.tools.doclets.internal.toolkit.util.Util.isDeprecated(Util.java:811)
at com.sun.tools.doclets.formats.html.SubWriterHolderWriter.printIndexComment(SubWriterHolderWriter.java:101)
at com.sun.tools.doclets.formats.html.SubWriterHolderWriter.printSummaryLinkComment(SubWriterHolderWriter.java:137)
at com.sun.tools.doclets.formats.html.AbstractMemberWriter.writeMemberSummary(AbstractMemberWriter.java:407)
at com.sun.tools.doclets.internal.toolkit.builders.MemberSummaryBuilder.buildSummary(MemberSummaryBuilder.java:309)
at com.sun.tools.doclets.internal.toolkit.builders.MemberSummaryBuilder.buildMethodsSummary(MemberSummaryBuilder.java:260)
at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)


This must have something to do with the "@Test" Annotation, because it works if I do comment it out. However, unit testing itself does work, only JavaDoc is the problem.

I'm using JUnit 4.4 with JDK 1.6.0_06.    <<Less

Re: running JavaDoc on JUnit test classes

Posted By:   Coolcat_Jumpman  
Posted On:   Saturday, July 12, 2008 10:06 AM

Ok, one way would be simply remove the "@Test"....JUnit does find the methods as well.


=> Problem solved, but it would be interesting why this problem appeared.
About | Sitemap | Contact