aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/musichub/util/XMLHandlerTest.java
diff options
context:
space:
mode:
authorClyhtsuriva <61652557+clyhtsuriva@users.noreply.github.com>2021-06-27 11:02:03 +0000
committerGitHub <noreply@github.com>2021-06-27 11:02:03 +0000
commite13eea333d7af2786dbbbb5ed60cea4593d5ee12 (patch)
treed87270f2e9cee0586a3c7b49033cefaca0c107d0 /src/test/java/musichub/util/XMLHandlerTest.java
parent18359e9e2892a332f283476bc3ae887308f51cec (diff)
parent9a234079437a1532072ed5f0bce0203922719b0f (diff)
Merge pull request #10 from Said-Belhadj/feature/STZ-0012
Feature/stz 0012
Diffstat (limited to 'src/test/java/musichub/util/XMLHandlerTest.java')
-rw-r--r--src/test/java/musichub/util/XMLHandlerTest.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/java/musichub/util/XMLHandlerTest.java b/src/test/java/musichub/util/XMLHandlerTest.java
new file mode 100644
index 0000000..7b5a791
--- /dev/null
+++ b/src/test/java/musichub/util/XMLHandlerTest.java
@@ -0,0 +1,30 @@
+package musichub.util;
+
+
+import org.junit.jupiter.api.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+
+public class XMLHandlerTest {
+
+ final String DIR = System.getProperty("user.dir");
+ final String JUNIT_FILE_PATH = DIR + "/files/JUnit.xml";
+
+ @Test
+ void testCreateXML() {
+ XMLHandler xmlHandler = new XMLHandler(); //XML class
+ Document document = xmlHandler.createXMLDocument(); //XMLDocument method
+ xmlHandler.createXMLFile(document, JUNIT_FILE_PATH); //XMLFile method
+ }
+
+ @Test
+ void testParseXMLFile() {
+ final String PARSE_DIR = System.getProperty("user.dir");
+ final String PARSE_FILE_PATH = PARSE_DIR + "/files/parse_JUnit.xml";
+ XMLHandler xmlHandler = new XMLHandler();
+ //wrong content of file resulting in an exception, will print it during test but it's normal
+ NodeList junitNodes = xmlHandler.parseXMLFile(JUNIT_FILE_PATH);
+ //right content of file
+ NodeList parseNodes = xmlHandler.parseXMLFile(PARSE_FILE_PATH);
+ }
+} \ No newline at end of file