001: package org.incava.doctorj;
002:
003: import junit.framework.TestCase;
004: import org.incava.analysis.Violation;
005:
006: public class TestClassDocAnalyzer extends TestTypeDocAnalyzer {
007: public TestClassDocAnalyzer(String name) {
008: super (name);
009: }
010:
011: public void testClassAuthorWithText() {
012: evaluate("/** This is a description.\n"
013: + " * @author e. e. cummings\n" + " */\n"
014: + "class Test {\n" + "}\n", new Violation[] {});
015:
016: evaluate("/** This is a description.\n" + " * @author I\n"
017: + " */\n" + "class Test {\n" + "}\n",
018: new Violation[] {});
019:
020: evaluate("/** This is a description.\n" + " * @author fred\n"
021: + " */\n" + "class Test {\n" + "}\n",
022: new Violation[] {});
023: }
024:
025: public void testClassAuthorWithoutText() {
026: evaluate("/** This is a description.\n" + " * @author\n"
027: + " */\n" + "class Test {\n" + "}\n",
028: new Violation[] { new Violation(
029: TypeDocAnalyzer.MSG_AUTHOR_WITHOUT_NAME, 2, 5,
030: 2, 11) });
031: }
032:
033: public void testClassAuthorWithoutTextSpaces() {
034: evaluate("/** This is a description.\n" + " * @author \n"
035: + " */\n" + "class Test {\n" + "}\n",
036: new Violation[] { new Violation(
037: TypeDocAnalyzer.MSG_AUTHOR_WITHOUT_NAME, 2, 5,
038: 2, 11) });
039:
040: evaluate("/** This is a description.\n" + " * @author \n"
041: + " */\n" + "class Test {\n" + "}\n",
042: new Violation[] { new Violation(
043: TypeDocAnalyzer.MSG_AUTHOR_WITHOUT_NAME, 2, 5,
044: 2, 11) });
045: }
046:
047: public void testClassVersionWithText() {
048: evaluate("/** This is a description.\n"
049: + " * @version 1.1.2\n" + " */\n" + "class Test {\n"
050: + "}\n", new Violation[] {});
051:
052: evaluate("/** This is a description.\n" + " * @version 1\n"
053: + " */\n" + "class Test {\n" + "}\n",
054: new Violation[] {});
055: }
056:
057: public void testClassVersionWithoutText() {
058: evaluate("/** This is a description.\n" + " * @version\n"
059: + " */\n" + "class Test {\n" + "}\n",
060: new Violation[] { new Violation(
061: TypeDocAnalyzer.MSG_VERSION_WITHOUT_TEXT, 2, 5,
062: 2, 12) });
063: }
064:
065: public void testClassVersionWithoutTextSpaces() {
066: evaluate("/** This is a description.\n" + " * @version \n"
067: + " */\n" + "class Test {\n" + "}\n",
068: new Violation[] { new Violation(
069: TypeDocAnalyzer.MSG_VERSION_WITHOUT_TEXT, 2, 5,
070: 2, 12) });
071:
072: evaluate("/** This is a description.\n" + " * @version \n"
073: + " */\n" + "class Test {\n" + "}\n",
074: new Violation[] { new Violation(
075: TypeDocAnalyzer.MSG_VERSION_WITHOUT_TEXT, 2, 5,
076: 2, 12) });
077: }
078:
079: public void testClassSerialWithText() {
080: evaluate("/** This is a description.\n"
081: + " * @serial This describes the serial field.\n"
082: + " */\n" + "class Test {\n" + "}\n",
083: new Violation[] {});
084:
085: evaluate("/** This is a description.\n"
086: + " * @serial description\n" + " */\n"
087: + "class Test {\n" + "}\n", new Violation[] {});
088: }
089:
090: public void testClassSerialWithoutText() {
091: evaluate("/** This is a description.\n" + " * @serial\n"
092: + " */\n" + "class Test {\n" + "}\n",
093: new Violation[] { new Violation(
094: TypeDocAnalyzer.MSG_SERIAL_WITHOUT_TEXT, 2, 5,
095: 2, 11) });
096: }
097:
098: public void testClassSerialWithoutTextSpaces() {
099: evaluate("/** This is a description.\n" + " * @serial \n"
100: + " */\n" + "class Test {\n" + "}\n",
101: new Violation[] { new Violation(
102: TypeDocAnalyzer.MSG_SERIAL_WITHOUT_TEXT, 2, 5,
103: 2, 11) });
104:
105: evaluate("/** This is a description.\n" + " * @serial \n"
106: + " */\n" + "class Test {\n" + "}\n",
107: new Violation[] { new Violation(
108: TypeDocAnalyzer.MSG_SERIAL_WITHOUT_TEXT, 2, 5,
109: 2, 11) });
110: }
111:
112: }
|