KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > incava > doctorj > TestFunctionDocAnalyzer


1 package org.incava.doctorj;
2
3 import junit.framework.TestCase;
4 import org.incava.analysis.Violation;
5
6
7 public class TestFunctionDocAnalyzer extends Tester
8 {
9     public TestFunctionDocAnalyzer(String JavaDoc name)
10     {
11         super(name);
12     }
13
14     public void testMethodSerialDataOK()
15     {
16         evaluate("/** This is a description. */\n" +
17                  "class Test {\n" +
18                  " /** This is a description.\n" +
19                  " * @serialData Something.\n" +
20                  " */\n" +
21                  " void f() {}\n" +
22                  "}\n",
23                  new Violation[] {
24                  });
25     }
26
27     public void testCtorSerialDataOK()
28     {
29         evaluate("/** This is a description. */\n" +
30                  "class Test {\n" +
31                  " /** This is a description.\n" +
32                  " * @serialData Something.\n" +
33                  " */\n" +
34                  " Test() {}\n" +
35                  "}\n",
36                  new Violation[] {
37                  });
38     }
39
40     public void testMethodSerialDataUndescribed()
41     {
42         evaluate("/** This is a description. */\n" +
43                  "class Test {\n" +
44                  " /** This is a description.\n" +
45                  " * @serialData \n" +
46                  " */\n" +
47                  " void f() {}\n" +
48                  "}\n",
49                  new Violation[] {
50                      new Violation(FunctionDocAnalyzer.MSG_SERIALDATA_WITHOUT_DESCRIPTION, 4, 9, 4, 19)
51                  });
52     }
53
54     public void testCtorSerialDataUndescribed()
55     {
56         evaluate("/** This is a description. */\n" +
57                  "class Test {\n" +
58                  " /** This is a description.\n" +
59                  " * @serialData \n" +
60                  " */\n" +
61                  " Test() {}\n" +
62                  "}\n",
63                  new Violation[] {
64                      new Violation(FunctionDocAnalyzer.MSG_SERIALDATA_WITHOUT_DESCRIPTION, 4, 9, 4, 19)
65                  });
66     }
67     
68 }
69
Popular Tags