aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/musichub/util/LogHandlerTest.java
blob: 17b47f6bcd11ad7f2383426d1cec436e1aa4af94 (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 testWrite() {
        try {
            write("JUnit test", "INFO");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

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

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