aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/musichub
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2021-06-26 14:32:12 +0200
committerClyhtsuriva <aimeric@adjutor.xyz>2021-06-26 14:32:12 +0200
commite9ee951e570c441151385d1ccd8c4230abf704ca (patch)
treea0c875335ce68efd4959ee031dfa8671c9eaa78a /src/test/java/musichub
parenta57fd29902578adf7238d71cf9bbd55408584557 (diff)
Updated javadoc, added jacoco and the necessary JUnit for this feature.
Diffstat (limited to 'src/test/java/musichub')
-rw-r--r--src/test/java/musichub/business/PathValidationTest.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/test/java/musichub/business/PathValidationTest.java b/src/test/java/musichub/business/PathValidationTest.java
index 2b24d7a..fffbdde 100644
--- a/src/test/java/musichub/business/PathValidationTest.java
+++ b/src/test/java/musichub/business/PathValidationTest.java
@@ -1,8 +1,26 @@
package musichub.business;
+import org.junit.jupiter.api.Test;
+
+import static musichub.business.PathValidation.isPathValid;
+import static org.junit.jupiter.api.Assertions.*;
+
public class PathValidationTest {
+ @Test
void testIsPathValid() {
- //Not implemented yet
+ assertTrue(isPathValid("Song/Side_To_Side.wav")); //the right path
+ assertFalse(isPathValid("wrong_path/Side_To_Side.wav")); //wrong path
+ assertFalse(isPathValid("Song/Side_To_Side.mp3")); //wrong extension
+ }
+
+ @Test
+ void testPathValidationClass() {
+ try {
+ PathValidation pathValidationClass = new PathValidation();
+ } catch (Error ex) {
+ assertTrue(ex instanceof AssertionError);
+ assertEquals("You just can't instantiate this class.", ex.getMessage());
+ }
}
-} \ No newline at end of file
+}