aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/musichub/util/PathValidationTest.java
blob: b0e0c384ef5f3c89010da5d38a30fed7a72cc7c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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")); //the right path
        assertFalse(isPathValid("wrong_path/Side_To_Side.wav")); //wrong path
        assertFalse(isPathValid("Song/Side_To_Side.mp3")); //wrong extension
    }
}