1 package de.fu_berlin.ties.xml;
2
3 import junit.framework.TestCase;
4
5 import de.fu_berlin.ties.xml.TagConstituent;
6
7
8 /***
9 * Generated by JUnitDoclet, a tool provided by
10 * ObjectFab GmbH under LGPL.
11 * Please see www.junitdoclet.org, www.gnu.org
12 * and www.objectfab.de for informations about
13 * the tool, the licence and the authors.
14 */
15
16
17 public class TagConstituentTest
18
19 extends TestCase
20
21 {
22
23 final short type[] = {
24 TagConstituent.START_TAG,
25 TagConstituent.END_TAG,
26 };
27 final String[] name = {
28 "body",
29 "html"
30 };
31 final String[] rep = {
32 "<body bgcolor='red'>",
33 "</html>"
34 };
35 final int[] markupSeries = {
36 0,
37 7
38 };
39 TagConstituent[] tagConsts = new TagConstituent[type.length];
40
41
42 public TagConstituentTest(String name) {
43
44 super(name);
45
46 }
47
48 public de.fu_berlin.ties.xml.TagConstituent createInstance() throws Exception {
49
50
51 TagConstituent tagConst = null;
52 try {
53 tagConst = new TagConstituent(OtherConstituent.DOCTYPE, "noname",
54 "<no rep>", 3);
55 fail("Constructor should have thrown exception");
56 } catch (IllegalArgumentException iae) {
57
58 }
59
60 try {
61 tagConst = new TagConstituent((short)-1, "noname", "<no rep>", 3);
62 fail("Constructor should have thrown exception");
63 } catch (IllegalArgumentException iae) {
64
65 }
66
67 return tagConst;
68
69 }
70
71 protected void setUp() throws Exception {
72
73 super.setUp();
74 createInstance();
75 for (int i = 0; i < tagConsts.length; i++) {
76 tagConsts[i] = new
77 TagConstituent(type[i], name[i], rep[i], markupSeries[i]);
78 if (i > 0) {
79 tagConsts[i-1].insertAfter(tagConsts[i]);
80 }
81 }
82
83 }
84
85 protected void tearDown() throws Exception {
86
87 for (int i = 0; i < tagConsts.length; i++) {
88 tagConsts[i] = null;
89 }
90 super.tearDown();
91
92 }
93
94 public void testGetName() throws Exception {
95
96 for (int i = 0; i < tagConsts.length; i++) {
97 assertEquals(tagConsts[i].getName(), name[i]);
98 }
99
100 }
101
102 public void testSetGetMarkupSeriesNo() throws Exception {
103
104 final int newNo = 17;
105 for (int i = 0; i < tagConsts.length; i++) {
106 assertEquals(tagConsts[i].getMarkupSeriesNo(), markupSeries[i]);
107 tagConsts[i].setMarkupSeriesNo(newNo);
108 assertEquals(tagConsts[i].getMarkupSeriesNo(), newNo);
109 tagConsts[i].setMarkupSeriesNo(-1);
110 assertEquals(tagConsts[i].getMarkupSeriesNo(), -1);
111 }
112
113 }
114
115 public void testSetGetVariety() throws Exception {
116
117 de.fu_berlin.ties.xml.TagVariety[] tests = {TagVariety.REGULAR,
118 TagVariety.TENTATIVE, null};
119
120 for (int i = 0; i < tests.length; i++) {
121 tagConsts[0].setVariety(tests[i]);
122 assertEquals(tests[i], tagConsts[0].getVariety());
123 }
124
125 }
126
127 public void testToString() throws Exception {
128
129
130
131 }
132
133
134
135 /***
136 * JUnitDoclet moves marker to this method, if there is not match
137 * for them in the regenerated code and if the marker is not empty.
138 * This way, no test gets lost when regenerating after renaming.
139 * Method testVault is supposed to be empty.
140 */
141 public void testVault() throws Exception {
142
143
144 }
145
146 public static void main(String[] args) {
147
148 junit.textui.TestRunner.run(TagConstituentTest.class);
149
150 }
151 }