-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogLevelsTest.java
More file actions
65 lines (52 loc) · 1.85 KB
/
LogLevelsTest.java
File metadata and controls
65 lines (52 loc) · 1.85 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import org.junit.Test;
import static org.assertj.core.api.Assertions.*;
public class LogLevelsTest {
@Test
public void error_message() {
assertThat(LogLevels.message("[ERROR]: Stack overflow")).isEqualTo("Stack overflow");
}
@Test
public void warning_message() {
assertThat(LogLevels.message("[WARNING]: Disk almost full")).isEqualTo("Disk almost full");
}
@Test
public void info_message() {
assertThat(LogLevels.message("[INFO]: File moved")).isEqualTo("File moved");
}
@Test
public void message_with_leading_and_trailing_white_space() {
assertThat(LogLevels.message("[WARNING]: \tTimezone not set \r\n")).isEqualTo("Timezone not set");
}
@Test
public void error_log_level() {
assertThat(LogLevels.logLevel("[ERROR]: Disk full")).isEqualTo("error");
}
@Test
public void warning_log_level() {
assertThat(LogLevels.logLevel("[WARNING]: Unsafe password")).isEqualTo("warning");
}
@Test
public void info_log_level() {
assertThat(LogLevels.logLevel("[INFO]: Timezone changed")).isEqualTo("info");
}
@Test
public void error_reformat() {
assertThat(LogLevels.reformat("[ERROR]: Segmentation fault"))
.isEqualTo("Segmentation fault (error)");
}
@Test
public void warning_reformat() {
assertThat(LogLevels.reformat("[WARNING]: Decreased performance"))
.isEqualTo("Decreased performance (warning)");
}
@Test
public void info_reformat() {
assertThat(LogLevels.reformat("[INFO]: Disk defragmented"))
.isEqualTo("Disk defragmented (info)");
}
@Test
public void reformat_with_leading_and_trailing_white_space() {
assertThat(LogLevels.reformat("[ERROR]: \t Corrupt disk\t \t \r\n"))
.isEqualTo("Corrupt disk (error)");
}
}