aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/musichub/util/LogHandlerTest.java
blob: ab8e160a1df44cf6b2fcb567c42d0d927d691ff5 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package musichub.util;


import org.junit.jupiter.api.Test;

import java.io.IOException;

import static musichub.util.LogHandler.read;
import static musichub.util.LogHandler.write;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class LogHandlerTest {
    @Test
    void testLogHandlerClass() {
        try {
            LogHandler logHandlerClass = new LogHandler();
        } catch (Error e) {
            assertTrue(e instanceof AssertionError);
            assertEquals("You just can't instantiate this class.", e.getMessage());
        }
    }

    @Test
    void testWrite() {
        try {
            write("JUnit test", "TEST");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Test
    void testRead() {
        try {
            read();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}