aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/musichub/business/PlayListTest.java
diff options
context:
space:
mode:
authorClyhtsuriva <61652557+clyhtsuriva@users.noreply.github.com>2021-06-28 21:40:03 +0000
committerGitHub <noreply@github.com>2021-06-28 21:40:03 +0000
commit1504d0255279133668b85f5c092f040a14fbc35f (patch)
tree0c9b9e927aa4d5f35ccc07e45e8abd973b2bad08 /src/test/java/musichub/business/PlayListTest.java
parent48d56d9db8fe93f1e1799674fefabdfc677d2eb7 (diff)
parent49196ae84aea338dbc6cd10f4d135e4b717cdd1f (diff)
Merge pull request #23 from Said-Belhadj/developHEADmaster
Merging develop to master.
Diffstat (limited to 'src/test/java/musichub/business/PlayListTest.java')
-rw-r--r--src/test/java/musichub/business/PlayListTest.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/test/java/musichub/business/PlayListTest.java b/src/test/java/musichub/business/PlayListTest.java
new file mode 100644
index 0000000..9fe63cf
--- /dev/null
+++ b/src/test/java/musichub/business/PlayListTest.java
@@ -0,0 +1,54 @@
+package musichub.business;
+
+import musichub.util.XMLHandler;
+import org.junit.jupiter.api.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import java.util.ArrayList;
+import java.util.UUID;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+public class PlayListTest {
+ final String DIR = System.getProperty("user.dir");
+ final String PLAYLISTS_FILE_PATH = DIR + "/files/playlists.xml";
+ final XMLHandler xmlHandler = new XMLHandler();
+ String title = "Side To Side";
+ String id = "66d277ca-cbc4-471c-a07e-082363375bcc";
+ ArrayList<UUID> elementUUIDs = null;
+
+ @Test
+ void testPlaylistClass() {
+ new PlayList(title, id, elementUUIDs);
+ new PlayList(title);
+
+ }
+
+ @Test
+ void testPlaylistClassXML() {
+ NodeList playlistNodes = xmlHandler.parseXMLFile(PLAYLISTS_FILE_PATH);
+ Element playlistElement = (Element) playlistNodes.item(1);
+ new PlayList(playlistElement);
+ }
+
+ @Test
+ void testGetElements() {
+ assertNull(new PlayList(title, id, elementUUIDs).getElements());
+ }
+
+ @Test
+ void testGetTitle() {
+ assertEquals(new PlayList(title).getTitle(), "Side To Side");
+ assertNotEquals(new PlayList(title).getTitle(), "God Is A Woman");
+ }
+
+ @Test
+ void testCreateXMLElement() {
+ PlayList p = new PlayList(title);
+ Document document = xmlHandler.createXMLDocument();
+ Element root = document.createElement("playlists");
+ p.createXMLElement(document, root);
+ }
+}