From f5117515ab26658e93d9efc2d99651c332840782 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sun, 27 Jun 2021 13:24:40 +0200 Subject: Added an extension check for songs and covered it with a test. --- src/test/java/musichub/util/PathValidationTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/test') diff --git a/src/test/java/musichub/util/PathValidationTest.java b/src/test/java/musichub/util/PathValidationTest.java index b0e0c38..f087ac1 100644 --- a/src/test/java/musichub/util/PathValidationTest.java +++ b/src/test/java/musichub/util/PathValidationTest.java @@ -19,8 +19,9 @@ public class PathValidationTest { @Test void testIsPathValid() { - 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 + 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) } } -- cgit v1.2.3