aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/musichub/util/PathValidationTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/musichub/util/PathValidationTest.java')
-rw-r--r--src/test/java/musichub/util/PathValidationTest.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/java/musichub/util/PathValidationTest.java b/src/test/java/musichub/util/PathValidationTest.java
new file mode 100644
index 0000000..f087ac1
--- /dev/null
+++ b/src/test/java/musichub/util/PathValidationTest.java
@@ -0,0 +1,27 @@
+package musichub.util;
+
+
+import org.junit.jupiter.api.Test;
+
+import static musichub.util.PathValidation.isPathValid;
+import static org.junit.jupiter.api.Assertions.*;
+
+public class PathValidationTest {
+ @Test
+ void testPathValidationClass() {
+ try {
+ PathValidation pathValidationClass = new PathValidation();
+ } catch (Error e) {
+ assertTrue(e instanceof AssertionError);
+ assertEquals("You just can't instantiate this class.", e.getMessage());
+ }
+ }
+
+ @Test
+ void testIsPathValid() {
+ assertTrue(isPathValid("Song/Side_To_Side.wav")); //right path, right file, right extension
+ assertFalse(isPathValid("wrong_path/Side_To_Side.wav")); //wrong path, right file, right extension
+ assertFalse(isPathValid("Song/Side_To_Side.mp3")); //right path, right file, wrong extension
+ assertFalse(isPathValid("Song/Side_To_Sidewav")); //right path, right file, wrong extension (without a dot)
+ }
+}