|
| 1 | +package test.com; |
| 2 | + |
| 3 | +import com.XmlUtils; |
| 4 | +import org.junit.Test; |
| 5 | +import org.junit.Before; |
| 6 | +import org.junit.After; |
| 7 | + |
| 8 | +/** |
| 9 | +* XmlUtils Tester. |
| 10 | +* |
| 11 | +* @author <Authors name> |
| 12 | +* @since <pre>02/28/2018</pre> |
| 13 | +* @version 1.0 |
| 14 | +*/ |
| 15 | +public class XmlUtilsTest { |
| 16 | + private XmlUtils xmlUtils=new XmlUtils(); |
| 17 | + private String text="<csdn><java>Java班</java><net>Net班</net></csdn>"; |
| 18 | + private String fileName1="E:\\test.xml"; |
| 19 | + private String fileName2="E:\\test2.xml"; |
| 20 | + private String[] names=new String[]{"西游记","作者"}; |
| 21 | + |
| 22 | +@Before |
| 23 | +public void before() throws Exception { |
| 24 | +} |
| 25 | + |
| 26 | +@After |
| 27 | +public void after() throws Exception { |
| 28 | +} |
| 29 | + |
| 30 | +/** |
| 31 | +* |
| 32 | +* Method: getXmlContent() |
| 33 | +* |
| 34 | +*/ |
| 35 | +@Test |
| 36 | +public void testGetXmlContent() throws Exception { |
| 37 | +//TODO: Test goes here... |
| 38 | + xmlUtils.getXmlContent(fileName1,names); |
| 39 | +} |
| 40 | + |
| 41 | + |
| 42 | + /** |
| 43 | + * |
| 44 | + * Method: stringToDocument() |
| 45 | + * |
| 46 | + */ |
| 47 | + @Test |
| 48 | + public void testStringToDocument() throws Exception { |
| 49 | +//TODO: Test goes here... |
| 50 | + xmlUtils.stringToXml(text,fileName2); |
| 51 | + } |
| 52 | + /** |
| 53 | + * |
| 54 | + * Method: createDocumentToXml() |
| 55 | + * |
| 56 | + */ |
| 57 | + @Test |
| 58 | + public void testCreateDocumentToXml() throws Exception { |
| 59 | +//TODO: Test goes here... |
| 60 | + xmlUtils.createDocumentToXml(fileName2); |
| 61 | + } |
| 62 | + |
| 63 | + |
| 64 | + /** |
| 65 | + * |
| 66 | + * Method: listNodes(Element node) |
| 67 | + * |
| 68 | + */ |
| 69 | + @Test |
| 70 | + public void testListNodes() throws Exception { |
| 71 | +//TODO: Test goes here... |
| 72 | + |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * |
| 77 | + * Method: getElementText(String fileName) |
| 78 | + * |
| 79 | + */ |
| 80 | + @Test |
| 81 | + public void testGetElementText() throws Exception { |
| 82 | +//TODO: Test goes here... |
| 83 | + xmlUtils.getElementText(fileName1); |
| 84 | + } |
| 85 | + |
| 86 | + /** |
| 87 | + * |
| 88 | + * Method: writeToXml(Document document, String fileName) |
| 89 | + * |
| 90 | + */ |
| 91 | + @Test |
| 92 | + public void testWriteToXml() throws Exception { |
| 93 | +//TODO: Test goes here... |
| 94 | + |
| 95 | + } |
| 96 | + |
| 97 | + /** |
| 98 | + * |
| 99 | + * Method: addAttributeToXml(String fileName) |
| 100 | + * |
| 101 | + */ |
| 102 | + @Test |
| 103 | + public void testAddAttributeToXml() throws Exception { |
| 104 | +//TODO: Test goes here... |
| 105 | + xmlUtils.addAttributeToXml(fileName1); |
| 106 | + } |
| 107 | +} |
0 commit comments