|
@@ -23,7 +23,7 @@ package com.dmdirc.logger;
|
23
|
23
|
|
24
|
24
|
import org.junit.Test;
|
25
|
25
|
|
26
|
|
-import static org.junit.Assert.assertFalse;
|
|
26
|
+import static junit.framework.TestCase.assertEquals;
|
27
|
27
|
import static org.junit.Assert.assertTrue;
|
28
|
28
|
|
29
|
29
|
public class ErrorLevelTest {
|
|
@@ -48,52 +48,52 @@ public class ErrorLevelTest {
|
48
|
48
|
|
49
|
49
|
@Test
|
50
|
50
|
public void testMoreImportantLow() {
|
51
|
|
- assertTrue(ErrorLevel.LOW.moreImportant(ErrorLevel.MEDIUM));
|
52
|
|
- assertTrue(ErrorLevel.LOW.moreImportant(ErrorLevel.HIGH));
|
53
|
|
- assertTrue(ErrorLevel.LOW.moreImportant(ErrorLevel.FATAL));
|
54
|
|
- assertFalse(ErrorLevel.LOW.moreImportant(ErrorLevel.LOW));
|
55
|
|
- assertFalse(ErrorLevel.LOW.moreImportant(ErrorLevel.UNKNOWN));
|
56
|
|
- assertFalse(ErrorLevel.LOW.moreImportant(null));
|
|
51
|
+ assertEquals(ErrorLevel.MEDIUM, ErrorLevel.LOW.getMoreImportant(ErrorLevel.MEDIUM));
|
|
52
|
+ assertEquals(ErrorLevel.HIGH, ErrorLevel.LOW.getMoreImportant(ErrorLevel.HIGH));
|
|
53
|
+ assertEquals(ErrorLevel.FATAL, ErrorLevel.LOW.getMoreImportant(ErrorLevel.FATAL));
|
|
54
|
+ assertEquals(ErrorLevel.LOW, ErrorLevel.LOW.getMoreImportant(ErrorLevel.LOW));
|
|
55
|
+ assertEquals(ErrorLevel.LOW, ErrorLevel.LOW.getMoreImportant(ErrorLevel.UNKNOWN));
|
|
56
|
+ assertEquals(ErrorLevel.LOW, ErrorLevel.LOW.getMoreImportant(null));
|
57
|
57
|
}
|
58
|
58
|
|
59
|
59
|
@Test
|
60
|
60
|
public void testMoreImportantMedium() {
|
61
|
|
- assertFalse(ErrorLevel.MEDIUM.moreImportant(ErrorLevel.MEDIUM));
|
62
|
|
- assertTrue(ErrorLevel.MEDIUM.moreImportant(ErrorLevel.HIGH));
|
63
|
|
- assertTrue(ErrorLevel.MEDIUM.moreImportant(ErrorLevel.FATAL));
|
64
|
|
- assertFalse(ErrorLevel.MEDIUM.moreImportant(ErrorLevel.LOW));
|
65
|
|
- assertFalse(ErrorLevel.MEDIUM.moreImportant(ErrorLevel.UNKNOWN));
|
66
|
|
- assertFalse(ErrorLevel.MEDIUM.moreImportant(null));
|
|
61
|
+ assertEquals(ErrorLevel.MEDIUM, ErrorLevel.MEDIUM.getMoreImportant(ErrorLevel.MEDIUM));
|
|
62
|
+ assertEquals(ErrorLevel.HIGH, ErrorLevel.MEDIUM.getMoreImportant(ErrorLevel.HIGH));
|
|
63
|
+ assertEquals(ErrorLevel.FATAL, ErrorLevel.MEDIUM.getMoreImportant(ErrorLevel.FATAL));
|
|
64
|
+ assertEquals(ErrorLevel.MEDIUM, ErrorLevel.MEDIUM.getMoreImportant(ErrorLevel.LOW));
|
|
65
|
+ assertEquals(ErrorLevel.MEDIUM, ErrorLevel.MEDIUM.getMoreImportant(ErrorLevel.UNKNOWN));
|
|
66
|
+ assertEquals(ErrorLevel.MEDIUM, ErrorLevel.MEDIUM.getMoreImportant(null));
|
67
|
67
|
}
|
68
|
68
|
|
69
|
69
|
@Test
|
70
|
70
|
public void testMoreImportantHigh() {
|
71
|
|
- assertFalse(ErrorLevel.HIGH.moreImportant(ErrorLevel.MEDIUM));
|
72
|
|
- assertFalse(ErrorLevel.HIGH.moreImportant(ErrorLevel.HIGH));
|
73
|
|
- assertTrue(ErrorLevel.HIGH.moreImportant(ErrorLevel.FATAL));
|
74
|
|
- assertFalse(ErrorLevel.HIGH.moreImportant(ErrorLevel.LOW));
|
75
|
|
- assertFalse(ErrorLevel.HIGH.moreImportant(ErrorLevel.UNKNOWN));
|
76
|
|
- assertFalse(ErrorLevel.HIGH.moreImportant(null));
|
|
71
|
+ assertEquals(ErrorLevel.HIGH, ErrorLevel.HIGH.getMoreImportant(ErrorLevel.MEDIUM));
|
|
72
|
+ assertEquals(ErrorLevel.HIGH, ErrorLevel.HIGH.getMoreImportant(ErrorLevel.HIGH));
|
|
73
|
+ assertEquals(ErrorLevel.FATAL, ErrorLevel.HIGH.getMoreImportant(ErrorLevel.FATAL));
|
|
74
|
+ assertEquals(ErrorLevel.HIGH, ErrorLevel.HIGH.getMoreImportant(ErrorLevel.LOW));
|
|
75
|
+ assertEquals(ErrorLevel.HIGH, ErrorLevel.HIGH.getMoreImportant(ErrorLevel.UNKNOWN));
|
|
76
|
+ assertEquals(ErrorLevel.HIGH, ErrorLevel.HIGH.getMoreImportant(null));
|
77
|
77
|
}
|
78
|
78
|
|
79
|
79
|
@Test
|
80
|
80
|
public void testMoreImportantFatal() {
|
81
|
|
- assertFalse(ErrorLevel.FATAL.moreImportant(ErrorLevel.MEDIUM));
|
82
|
|
- assertFalse(ErrorLevel.FATAL.moreImportant(ErrorLevel.HIGH));
|
83
|
|
- assertFalse(ErrorLevel.FATAL.moreImportant(ErrorLevel.FATAL));
|
84
|
|
- assertFalse(ErrorLevel.FATAL.moreImportant(ErrorLevel.LOW));
|
85
|
|
- assertFalse(ErrorLevel.FATAL.moreImportant(ErrorLevel.UNKNOWN));
|
86
|
|
- assertFalse(ErrorLevel.FATAL.moreImportant(null));
|
|
81
|
+ assertEquals(ErrorLevel.FATAL, ErrorLevel.FATAL.getMoreImportant(ErrorLevel.MEDIUM));
|
|
82
|
+ assertEquals(ErrorLevel.FATAL, ErrorLevel.FATAL.getMoreImportant(ErrorLevel.HIGH));
|
|
83
|
+ assertEquals(ErrorLevel.FATAL, ErrorLevel.FATAL.getMoreImportant(ErrorLevel.FATAL));
|
|
84
|
+ assertEquals(ErrorLevel.FATAL, ErrorLevel.FATAL.getMoreImportant(ErrorLevel.LOW));
|
|
85
|
+ assertEquals(ErrorLevel.FATAL, ErrorLevel.FATAL.getMoreImportant(ErrorLevel.UNKNOWN));
|
|
86
|
+ assertEquals(ErrorLevel.FATAL, ErrorLevel.FATAL.getMoreImportant(null));
|
87
|
87
|
}
|
88
|
88
|
|
89
|
89
|
@Test
|
90
|
90
|
public void testMoreImportantUnknown() {
|
91
|
|
- assertTrue(ErrorLevel.UNKNOWN.moreImportant(ErrorLevel.MEDIUM));
|
92
|
|
- assertTrue(ErrorLevel.UNKNOWN.moreImportant(ErrorLevel.HIGH));
|
93
|
|
- assertTrue(ErrorLevel.UNKNOWN.moreImportant(ErrorLevel.FATAL));
|
94
|
|
- assertTrue(ErrorLevel.UNKNOWN.moreImportant(ErrorLevel.LOW));
|
95
|
|
- assertFalse(ErrorLevel.UNKNOWN.moreImportant(ErrorLevel.UNKNOWN));
|
96
|
|
- assertFalse(ErrorLevel.UNKNOWN.moreImportant(null));
|
|
91
|
+ assertEquals(ErrorLevel.MEDIUM, ErrorLevel.UNKNOWN.getMoreImportant(ErrorLevel.MEDIUM));
|
|
92
|
+ assertEquals(ErrorLevel.HIGH, ErrorLevel.UNKNOWN.getMoreImportant(ErrorLevel.HIGH));
|
|
93
|
+ assertEquals(ErrorLevel.FATAL, ErrorLevel.UNKNOWN.getMoreImportant(ErrorLevel.FATAL));
|
|
94
|
+ assertEquals(ErrorLevel.LOW, ErrorLevel.UNKNOWN.getMoreImportant(ErrorLevel.LOW));
|
|
95
|
+ assertEquals(ErrorLevel.UNKNOWN, ErrorLevel.UNKNOWN.getMoreImportant(ErrorLevel.UNKNOWN));
|
|
96
|
+ assertEquals(ErrorLevel.UNKNOWN, ErrorLevel.UNKNOWN.getMoreImportant(null));
|
97
|
97
|
}
|
98
|
98
|
|
99
|
99
|
}
|