aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/musichub/business
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2021-06-27 11:55:45 +0200
committerClyhtsuriva <aimeric@adjutor.xyz>2021-06-27 11:55:45 +0200
commita9f46e2164f0d9ce416f34ebcb68d532de98cdb2 (patch)
treee66ad903863bc37d1a0178dbc1297d24820487df /src/test/java/musichub/business
parent2969d3ea0553e5a1eed8db274bb89e94a082b1c1 (diff)
Starting Song tests
Diffstat (limited to 'src/test/java/musichub/business')
-rw-r--r--src/test/java/musichub/business/SongTest.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/test/java/musichub/business/SongTest.java b/src/test/java/musichub/business/SongTest.java
new file mode 100644
index 0000000..b25b6d2
--- /dev/null
+++ b/src/test/java/musichub/business/SongTest.java
@@ -0,0 +1,46 @@
+package musichub.business;
+
+import musichub.util.XMLHandler;
+import org.junit.jupiter.api.Test;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+public class SongTest {
+ String title = "Side To Side";
+ String artist = "Ariana Grande";
+ int length = 186;
+ String uid = "66d277ca-cbc4-471c-a07e-082363375bcc";
+ String content = "Song/Side_To_Side.wav";
+ String genre = "rock";
+
+ @Test
+ void testSongClasses() {
+ Song song_uuid = new Song(title, artist, length, uid, content, genre);
+ Song song = new Song(title, artist, length, content, genre);
+
+ }
+
+ @Test
+ void testSongXml() {
+ final String DIR = System.getProperty("user.dir");
+ final String ELEMENTS_FILE_PATH = DIR + "/files/elements.xml";
+ final XMLHandler xmlHandler = new XMLHandler();
+ NodeList audioelementsNodes = xmlHandler.parseXMLFile(ELEMENTS_FILE_PATH);
+ Element audioElement = (Element) audioelementsNodes.item(1);
+ Song song_xml = new Song(audioElement);
+ }
+
+ @Test
+ void testGetGenre() {
+ assertEquals(new Song(title, artist, length, content, genre).getGenre(), "rock");
+ assertNotEquals(new Song(title, artist, length, content, genre).getGenre(), "pop");
+ }
+
+ @Test
+ void testSetGenre() {
+ // Not Implemented Yet
+ }
+}