|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
FailTagHandlerT.java | - | 100% | 100% | 100% |
|
1 |
package junit.extensions.xml.elements;
|
|
2 |
|
|
3 |
import org.w3c.dom.Element;
|
|
4 |
import junit.extensions.xml.IXMLTestCase;
|
|
5 |
import junit.extensions.xml.XMLException;
|
|
6 |
import junit.framework.AssertionFailedError;
|
|
7 |
import junit.framework.TestCase;
|
|
8 |
import junit.extensions.xml.XMLTagResourceBundle;
|
|
9 |
|
|
10 |
/**
|
|
11 |
* <p>Title: Test Fail Tag handler.</p>
|
|
12 |
* <p>Description: </p>
|
|
13 |
* <p>Copyright: Copyright (c) 2003</p>
|
|
14 |
* <p>Company: </p>
|
|
15 |
* @author Kevin Wilson not attributable
|
|
16 |
* @version 1.0
|
|
17 |
*/
|
|
18 |
|
|
19 |
public class FailTagHandlerT extends TestCase { |
|
20 |
/**
|
|
21 |
* handler to be tested.
|
|
22 |
*/
|
|
23 |
private FailTagHandler m_failTagHandler = null; |
|
24 |
|
|
25 |
/**
|
|
26 |
* element fixture.
|
|
27 |
*/
|
|
28 |
private ElementFixture m_elementFixture;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Setup the test.
|
|
32 |
* @throws Exception may be thrown.
|
|
33 |
*/
|
|
34 | 2 |
protected void setUp() throws Exception { |
35 | 2 |
super.setUp();
|
36 | 2 |
m_elementFixture = new ElementFixture(this); |
37 |
|
|
38 | 2 |
m_elementFixture.setUp(); |
39 |
} |
|
40 |
|
|
41 |
/**
|
|
42 |
* Tear down the test.
|
|
43 |
* @throws Exception may be thrown.
|
|
44 |
*/
|
|
45 | 2 |
protected void tearDown() throws Exception { |
46 | 2 |
m_failTagHandler = null;
|
47 | 2 |
m_elementFixture.tearDown(); |
48 |
|
|
49 | 2 |
m_elementFixture = null;
|
50 | 2 |
super.tearDown();
|
51 |
} |
|
52 |
|
|
53 |
/**
|
|
54 |
* Test processing the Element.
|
|
55 |
* @throws XMLException may be thrown.
|
|
56 |
*/
|
|
57 | 1 |
public void testProcessElement() throws XMLException { |
58 | 1 |
IXMLTestCase tc = m_elementFixture.getTestCase(); |
59 | 1 |
Element e = m_elementFixture.newElement("fail", new String[] { |
60 |
|
|
61 |
}); |
|
62 | 1 |
m_failTagHandler = new FailTagHandler(e, tc);
|
63 | 1 |
AssertionFailedError err = null;
|
64 | 1 |
try {
|
65 | 1 |
m_failTagHandler.processElement(); |
66 |
} catch (AssertionFailedError afe) {
|
|
67 | 1 |
err = afe; |
68 |
} |
|
69 | 1 |
assertNotNull("Exception not thrown", err);
|
70 |
} |
|
71 |
|
|
72 |
/**
|
|
73 |
* Test with the Tag lookup.
|
|
74 |
*/
|
|
75 | 1 |
public void testLookup() { |
76 | 1 |
IXMLTestCase tc = m_elementFixture.getTestCase(); |
77 | 1 |
Element e = m_elementFixture.newElement("fail", new String[] { |
78 |
|
|
79 |
}); |
|
80 | 1 |
Object o = XMLTagResourceBundle.getTagHandler(e, tc, "fail");
|
81 | 1 |
assertNotNull(o); |
82 |
} |
|
83 |
} |
|
84 |
|
|