Clover coverage report - XJavaDoc - 1.1 Coverage timestamp: Sun Oct 3 2004 19:56:54 BST FRAMES NO FRAMES |
file stats: | LOC: | 114 |  | Methods: | 6
| NCLOC: | 59 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
XDocTest.java | - | 0% | 0% | 0% |

1 |  |
     /*
2 |  |
      * Copyright (c) 2001-2003 The XDoclet team
3 |  |
      * All rights reserved.
4 |  |
      */
5 |  |
     package xjavadoc;
6 |  |
7 |  |
     import java.io.*;
8 |  |
     import junit.framework.*;
9 |  |
     import xjavadoc.Token;
10 |  |
11 |  |
     /**
12 |  |
      * JUnit test for XDoc.
13 |  |
      *
14 |  |
      * @author      Aslak Hellesøy
15 |  |
      * @created     3. januar 2002
16 |  |
      * @ejb:bla     bla
17 |  |
      * @param what  about this one? Or this one?
18 |  |
      * @oh          dear="we" should="go to bed"
19 |  |
      */
20 |  |
     public class XDocTest extends TestCase
21 |  |
     {
22 |  |
23 |  |
         private XDoc       doc;
24 |  |
         /**
25 |  |
          * @param name     name of the test
26 |  |
          */
27 | 0 |
         public XDocTest( String name )
28 |  |
         {
29 | 0 |
             super( name );
30 |  |
         }
31 |  |
32 |  |
         /**
33 |  |
          * setup doc for testing
34 |  |
          *
35 |  |
          * @exception IOException
36 |  |
          */
37 | 0 |
         public void setUp() throws IOException
38 |  |
         {
39 | 0 |
             String javadoc =
40 |  |
                 "/********************** This is in the doc too      \n" +
41 |  |
                 " * JUnit test for\n" +
42 |  |
                 "   * JavaDocReader.    \n" +
43 |  |
                 "   * This is sentence number two.   \n" +
44 |  |
                 "     * @ejb:bla * bla\n" +
45 |  |
                 " *   @param what about\n" +
46 |  |
                 " * this one?\n" +
47 |  |
                 " *Or this\n" +
48 |  |
                 "     one?\n" +
49 |  |
                 " * @oh dear=\"we\" should=\"go to bed\"\n" +
50 |  |
                 " */";
51 |  |
52 | 0 |
             Token token = Token.newToken( 0 );
53 |  |
54 | 0 |
             token.image = javadoc;
55 | 0 |
             doc = new XDoc( token, null, null );
56 |  |
57 |  |
         }
58 |  |
59 |  |
         /**
60 |  |
          * test comment text and first sentence
61 |  |
          *
62 |  |
          * @exception IOException  Describe the exception
63 |  |
          */
64 | 0 |
         public void testFirstSentence() throws IOException
65 |  |
         {
66 |  |
67 | 0 |
             assertEquals( "This is in the doc too JUnit test for JavaDocReader.", doc.getFirstSentence() );
68 | 0 |
             assertEquals( "This is in the doc too JUnit test for JavaDocReader. This is sentence number two.", doc.getCommentText() );
69 |  |
70 |  |
         }
71 |  |
72 | 0 |
         public void testCommentChange() throws IOException
73 |  |
         {
74 | 0 |
             doc.setCommentText( "foo bar baz blurge. And this is second sentence" );
75 |  |
76 | 0 |
             assertEquals( "foo bar baz blurge.", doc.getFirstSentence() );
77 | 0 |
             assertEquals( "foo bar baz blurge. And this is second sentence", doc.getCommentText() );
78 |  |
79 |  |
         }
80 |  |
81 | 0 |
         public void testTagCreationAndRemoval() throws IOException
82 |  |
         {
83 |  |
             //check tag creation
84 | 0 |
             doc.addTag( "foo:bar", "blurge=\"bang\" baz=\"blabla\" what's up?" );
85 |  |
86 | 0 |
             assertTrue( doc.hasTag( "foo:bar" ) );
87 |  |
88 |  |
             // and removal
89 | 0 |
             doc.removeTag( doc.getTag( "foo:bar" ) );
90 |  |
91 | 0 |
             assertTrue( !doc.hasTag( "foo:bar" ) );
92 |  |
93 |  |
         }
94 |  |
95 | 0 |
         public void testTagChange() throws IOException
96 |  |
         {
97 |  |
98 | 0 |
             doc.addTag( "foo:bar", "blurge=\"bang\" baz=\"blabla\" what's up?" );
99 |  |
100 | 0 |
             assertEquals( doc.getTagAttributeValue( "foo:bar", "blurge" ), "bang" );
101 |  |
102 | 0 |
             XTag tag = doc.getTag( "foo:bar" );
103 |  |
104 | 0 |
             tag.setAttribute( "blurge", "foo" );
105 | 0 |
             assertEquals( tag.getAttributeValue( "blurge" ), "foo" );
106 |  |
107 | 0 |
             tag.setAttribute( "foo", "bar" );
108 |  |
109 | 0 |
             assertEquals( doc.getTagAttributeValue( "foo:bar", "blurge" ), "foo" );
110 | 0 |
             assertEquals( doc.getTagAttributeValue( "foo:bar", "foo" ), "bar" );
111 |  |
112 |  |
         }
113 |  |
     }
114 |  |