01: package net.sourceforge.jaxor.parser.tests;
02:
03: import junit.framework.TestCase;
04: import net.sourceforge.jaxor.parser.Field;
05: import net.sourceforge.jaxor.parser.Get;
06: import net.sourceforge.jaxor.parser.Javadoc;
07: import net.sourceforge.jaxor.parser.Set;
08:
09: /*
10: * User: Mike
11: * Date: Oct 19, 2002
12: * Time: 2:22:26 PM
13: */
14:
15: public class FieldTest extends TestCase {
16:
17: private final Field f = new Field();
18:
19: protected void setUp() {
20: f.setName("Name");
21: f.setType("java.lang.String");
22: Get g = new Get();
23: g.addCharacterData("return null;");
24: f.addGet(g);
25: }
26:
27: public void testGetVariableName() {
28: assertEquals("_Name_field_proxy", f.getVariableName());
29: }
30:
31: public void testGetterSig() {
32: assertEquals("\tpublic java.lang.String getName();", f
33: .getGetterSig());
34: }
35:
36: public void testSetterSig() {
37: assertEquals("\tpublic void setName(java.lang.String param);",
38: f.getSetterSig());
39: }
40:
41: public void testJavadoc() {
42: String docstr = "/** this is some doc @param foo bar */";
43: Javadoc doc = new Javadoc();
44: doc.addCharacterData(docstr);
45: Get g2 = new Get();
46: g2.addJavadoc(doc);
47: g2.addCharacterData("return null;");
48: f.addGet(g2);
49:
50: Set s2 = new Set();
51: s2.addJavadoc(doc);
52: f.addSet(s2);
53:
54: assertEquals(docstr
55: + "\n\t\tpublic java.lang.String getName();", f
56: .getGetterSig());
57: assertEquals(docstr
58: + "\n\t\tpublic void setName(java.lang.String param);",
59: f.getSetterSig());
60: }
61: }
|