|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| package nu.xom.tests; |
|
22 |
| |
|
23 |
| import nu.xom.Attribute; |
|
24 |
| import nu.xom.Text; |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| public class AttributeTypeTest extends XOMTestCase { |
|
36 |
| |
|
37 |
3
| public AttributeTypeTest(String name) {
|
|
38 |
3
| super(name);
|
|
39 |
| } |
|
40 |
| |
|
41 |
1
| public void testEquals() {
|
|
42 |
1
| assertEquals(Attribute.Type.CDATA, Attribute.Type.CDATA);
|
|
43 |
1
| assertEquals(Attribute.Type.ID, Attribute.Type.ID);
|
|
44 |
1
| assertEquals(Attribute.Type.IDREF, Attribute.Type.IDREF);
|
|
45 |
1
| assertEquals(Attribute.Type.IDREFS, Attribute.Type.IDREFS);
|
|
46 |
1
| assertEquals(Attribute.Type.UNDECLARED, Attribute.Type.UNDECLARED);
|
|
47 |
1
| assertEquals(Attribute.Type.NMTOKEN, Attribute.Type.NMTOKEN);
|
|
48 |
1
| assertEquals(Attribute.Type.NMTOKENS, Attribute.Type.NMTOKENS);
|
|
49 |
1
| assertEquals(Attribute.Type.NOTATION, Attribute.Type.NOTATION);
|
|
50 |
1
| assertEquals(Attribute.Type.ENTITY, Attribute.Type.ENTITY);
|
|
51 |
1
| assertEquals(Attribute.Type.ENTITIES, Attribute.Type.ENTITIES);
|
|
52 |
1
| assertTrue(Attribute.Type.ENTITIES != Attribute.Type.ENTITY);
|
|
53 |
1
| assertTrue(Attribute.Type.CDATA != Attribute.Type.ID);
|
|
54 |
1
| assertTrue(Attribute.Type.ID != Attribute.Type.IDREF);
|
|
55 |
1
| assertTrue(Attribute.Type.ID != Attribute.Type.IDREFS);
|
|
56 |
1
| assertTrue(Attribute.Type.ID != Attribute.Type.NMTOKEN);
|
|
57 |
1
| assertTrue(Attribute.Type.ID != Attribute.Type.NMTOKENS);
|
|
58 |
1
| assertTrue(Attribute.Type.UNDECLARED != Attribute.Type.CDATA);
|
|
59 |
1
| assertTrue(Attribute.Type.NMTOKEN != Attribute.Type.CDATA);
|
|
60 |
| |
|
61 |
1
| assertFalse(Attribute.Type.CDATA.equals(new Integer(1)));
|
|
62 |
1
| assertFalse(Attribute.Type.CDATA.equals(new Text("data")));
|
|
63 |
| } |
|
64 |
| |
|
65 |
1
| public void testToString() {
|
|
66 |
1
| assertNotNull(Attribute.Type.CDATA.toString());
|
|
67 |
1
| assertNotNull(Attribute.Type.ID.toString());
|
|
68 |
1
| assertNotNull(Attribute.Type.IDREF.toString());
|
|
69 |
1
| assertNotNull(Attribute.Type.IDREFS.toString());
|
|
70 |
1
| assertNotNull(Attribute.Type.UNDECLARED.toString());
|
|
71 |
1
| assertNotNull(Attribute.Type.NMTOKEN.toString());
|
|
72 |
1
| assertNotNull(Attribute.Type.NMTOKENS.toString());
|
|
73 |
1
| assertNotNull(Attribute.Type.NOTATION.toString());
|
|
74 |
1
| assertNotNull(Attribute.Type.ENTITY.toString());
|
|
75 |
1
| assertNotNull(Attribute.Type.ENTITIES.toString());
|
|
76 |
| |
|
77 |
1
| assertTrue(Attribute.Type.CDATA.toString().length() > 10);
|
|
78 |
1
| assertTrue(Attribute.Type.ID.toString().length() > 10);
|
|
79 |
1
| assertTrue(Attribute.Type.IDREF.toString().length() > 10);
|
|
80 |
1
| assertTrue(Attribute.Type.IDREFS.toString().length() > 10);
|
|
81 |
1
| assertTrue(Attribute.Type.UNDECLARED.toString().length() > 10);
|
|
82 |
1
| assertTrue(Attribute.Type.NMTOKEN.toString().length() > 10);
|
|
83 |
1
| assertTrue(Attribute.Type.NMTOKENS.toString().length() > 10);
|
|
84 |
1
| assertTrue(Attribute.Type.NOTATION.toString().length() > 10);
|
|
85 |
1
| assertTrue(Attribute.Type.ENTITY.toString().length() > 10);
|
|
86 |
1
| assertTrue(Attribute.Type.ENTITIES.toString().length() > 10);
|
|
87 |
| |
|
88 |
1
| assertTrue(Attribute.Type.CDATA.toString().startsWith("[Attribute.Type"));
|
|
89 |
1
| assertTrue(Attribute.Type.ID.toString().startsWith("[Attribute.Type"));
|
|
90 |
1
| assertTrue(Attribute.Type.IDREF.toString().startsWith("[Attribute.Type"));
|
|
91 |
1
| assertTrue(Attribute.Type.IDREFS.toString().startsWith("[Attribute.Type"));
|
|
92 |
1
| assertTrue(Attribute.Type.UNDECLARED.toString().startsWith("[Attribute.Type"));
|
|
93 |
1
| assertTrue(Attribute.Type.NMTOKEN.toString().startsWith("[Attribute.Type"));
|
|
94 |
1
| assertTrue(Attribute.Type.NMTOKENS.toString().startsWith("[Attribute.Type"));
|
|
95 |
1
| assertTrue(Attribute.Type.NOTATION.toString().startsWith("[Attribute.Type"));
|
|
96 |
1
| assertTrue(Attribute.Type.ENTITY.toString().startsWith("[Attribute.Type"));
|
|
97 |
1
| assertTrue(Attribute.Type.ENTITIES.toString().startsWith("[Attribute.Type"));
|
|
98 |
| |
|
99 |
1
| assertTrue(Attribute.Type.CDATA.toString().endsWith("]"));
|
|
100 |
1
| assertTrue(Attribute.Type.ID.toString().endsWith("]"));
|
|
101 |
1
| assertTrue(Attribute.Type.IDREF.toString().endsWith("]"));
|
|
102 |
1
| assertTrue(Attribute.Type.IDREFS.toString().endsWith("]"));
|
|
103 |
1
| assertTrue(Attribute.Type.UNDECLARED.toString().endsWith("]"));
|
|
104 |
1
| assertTrue(Attribute.Type.NMTOKEN.toString().endsWith("]"));
|
|
105 |
1
| assertTrue(Attribute.Type.NMTOKENS.toString().endsWith("]"));
|
|
106 |
1
| assertTrue(Attribute.Type.NOTATION.toString().endsWith("]"));
|
|
107 |
1
| assertTrue(Attribute.Type.ENTITY.toString().endsWith("]"));
|
|
108 |
1
| assertTrue(Attribute.Type.ENTITIES.toString().endsWith("]"));
|
|
109 |
| |
|
110 |
| } |
|
111 |
| |
|
112 |
1
| public void testGetName() {
|
|
113 |
1
| assertEquals("ENUMERATION", Attribute.Type.ENUMERATION.getName());
|
|
114 |
1
| assertEquals("NOTATION", Attribute.Type.NOTATION.getName());
|
|
115 |
1
| assertEquals("ENTITY", Attribute.Type.ENTITY.getName());
|
|
116 |
1
| assertEquals("ENTITIES", Attribute.Type.ENTITIES.getName());
|
|
117 |
1
| assertEquals("CDATA", Attribute.Type.CDATA.getName());
|
|
118 |
1
| assertEquals("ID", Attribute.Type.ID.getName());
|
|
119 |
1
| assertEquals("IDREF", Attribute.Type.IDREF.getName());
|
|
120 |
1
| assertEquals("IDREFS", Attribute.Type.IDREFS.getName());
|
|
121 |
1
| assertEquals("NMTOKEN", Attribute.Type.NMTOKEN.getName());
|
|
122 |
1
| assertEquals("NMTOKENS", Attribute.Type.NMTOKENS.getName());
|
|
123 |
| } |
|
124 |
| |
|
125 |
| } |