|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
XMLProcedureT.java | - | 100% | 100% | 100% |
|
1 |
package junit.extensions.xml;
|
|
2 |
|
|
3 |
import org.w3c.dom.Element;
|
|
4 |
import junit.extensions.xml.elements.ElementFixture;
|
|
5 |
import junit.framework.TestCase;
|
|
6 |
|
|
7 |
/**
|
|
8 |
* <p>Title: XMLProcedure test case.</p>
|
|
9 |
* <p>Copyright: Copyright (c) 2003</p>
|
|
10 |
* <p>Company: JFCUnit OpenSource Project</p>
|
|
11 |
* @author Kevin Wilson
|
|
12 |
* @version 1.0
|
|
13 |
*/
|
|
14 |
public class XMLProcedureT |
|
15 |
extends TestCase {
|
|
16 |
/**
|
|
17 |
* procedure to be tested.
|
|
18 |
*/
|
|
19 |
private XMLProcedure m_xmlProcedure = null; |
|
20 |
/**
|
|
21 |
* test fixture.
|
|
22 |
*/
|
|
23 |
private ElementFixture m_fixture;
|
|
24 |
|
|
25 |
/**
|
|
26 |
* Constructor.
|
|
27 |
* @param name Name of the test case.
|
|
28 |
*/
|
|
29 | 1 |
public XMLProcedureT(final String name) {
|
30 | 1 |
super(name);
|
31 |
} |
|
32 |
|
|
33 |
/**
|
|
34 |
* Setup the test.
|
|
35 |
* @throws Exception may be thrown.
|
|
36 |
*/
|
|
37 | 1 |
protected void setUp() throws Exception { |
38 | 1 |
super.setUp();
|
39 | 1 |
m_fixture = new ElementFixture(this); |
40 | 1 |
m_fixture.setUp(); |
41 |
} |
|
42 |
|
|
43 |
/**
|
|
44 |
* Tear down the test.
|
|
45 |
* @throws Exception may be thrown.
|
|
46 |
*/
|
|
47 | 1 |
protected void tearDown() throws Exception { |
48 | 1 |
m_xmlProcedure = null;
|
49 | 1 |
m_fixture.tearDown(); |
50 |
|
|
51 | 1 |
m_fixture = null;
|
52 | 1 |
super.tearDown();
|
53 |
} |
|
54 |
|
|
55 |
/**
|
|
56 |
* Test the getElement.
|
|
57 |
*/
|
|
58 | 1 |
public void testGetElement() { |
59 | 1 |
String procedureName = "TEST";
|
60 | 1 |
Element element = m_fixture.newElement("procedure",
|
61 |
new String[] {
|
|
62 |
"name", procedureName});
|
|
63 | 1 |
m_xmlProcedure = new XMLProcedure(element);
|
64 |
|
|
65 | 1 |
String name = m_xmlProcedure.getName(); |
66 | 1 |
assertEquals("getName()", procedureName, name);
|
67 |
|
|
68 | 1 |
Element result = m_xmlProcedure.getElement(); |
69 | 1 |
assertSame("Element set should be the element returned", element, result);
|
70 |
|
|
71 |
} |
|
72 |
} |
|
73 |
|
|