|
1 |
| -import org.junit.Test; |
| 1 | +import org.junit.jupiter.api.DisplayName; |
| 2 | +import org.junit.jupiter.api.Tag; |
| 3 | +import org.junit.jupiter.api.Test; |
2 | 4 |
|
3 | 5 | import static org.assertj.core.api.Assertions.*;
|
4 | 6 |
|
5 | 7 | public class LogLevelsTest {
|
6 | 8 | @Test
|
| 9 | + @Tag("task:1") |
| 10 | + @DisplayName("The message method returns the log line's message of an error log") |
7 | 11 | public void error_message() {
|
8 | 12 | assertThat(LogLevels.message("[ERROR]: Stack overflow")).isEqualTo("Stack overflow");
|
9 | 13 | }
|
10 | 14 |
|
11 | 15 | @Test
|
| 16 | + @Tag("task:1") |
| 17 | + @DisplayName("The message method returns the log line's message of a warning log") |
12 | 18 | public void warning_message() {
|
13 | 19 | assertThat(LogLevels.message("[WARNING]: Disk almost full")).isEqualTo("Disk almost full");
|
14 | 20 | }
|
15 | 21 |
|
16 | 22 | @Test
|
| 23 | + @Tag("task:1") |
| 24 | + @DisplayName("The message method returns the log line's message of an info log") |
17 | 25 | public void info_message() {
|
18 | 26 | assertThat(LogLevels.message("[INFO]: File moved")).isEqualTo("File moved");
|
19 | 27 | }
|
20 | 28 |
|
21 | 29 | @Test
|
| 30 | + @Tag("task:1") |
| 31 | + @DisplayName("The message method returns the log line's message after removing leading and trailing spaces") |
22 | 32 | public void message_with_leading_and_trailing_white_space() {
|
23 | 33 | assertThat(LogLevels.message("[WARNING]: \tTimezone not set \r\n")).isEqualTo("Timezone not set");
|
24 | 34 | }
|
25 | 35 |
|
26 | 36 | @Test
|
| 37 | + @Tag("task:2") |
| 38 | + @DisplayName("The logLevel method returns the log level of an error log line") |
27 | 39 | public void error_log_level() {
|
28 | 40 | assertThat(LogLevels.logLevel("[ERROR]: Disk full")).isEqualTo("error");
|
29 | 41 | }
|
30 | 42 |
|
31 | 43 | @Test
|
| 44 | + @Tag("task:2") |
| 45 | + @DisplayName("The logLevel method returns the log level of a warning log line") |
32 | 46 | public void warning_log_level() {
|
33 | 47 | assertThat(LogLevels.logLevel("[WARNING]: Unsafe password")).isEqualTo("warning");
|
34 | 48 | }
|
35 | 49 |
|
36 | 50 | @Test
|
| 51 | + @Tag("task:2") |
| 52 | + @DisplayName("The logLevel method returns the log level of an info log line") |
37 | 53 | public void info_log_level() {
|
38 | 54 | assertThat(LogLevels.logLevel("[INFO]: Timezone changed")).isEqualTo("info");
|
39 | 55 | }
|
40 | 56 |
|
41 | 57 | @Test
|
| 58 | + @Tag("task:3") |
| 59 | + @DisplayName("The reformat method correctly reformats an error log line") |
42 | 60 | public void error_reformat() {
|
43 | 61 | assertThat(LogLevels.reformat("[ERROR]: Segmentation fault"))
|
44 | 62 | .isEqualTo("Segmentation fault (error)");
|
45 | 63 | }
|
46 | 64 |
|
47 | 65 | @Test
|
| 66 | + @Tag("task:3") |
| 67 | + @DisplayName("The reformat method correctly reformats a warning log line") |
48 | 68 | public void warning_reformat() {
|
49 | 69 | assertThat(LogLevels.reformat("[WARNING]: Decreased performance"))
|
50 | 70 | .isEqualTo("Decreased performance (warning)");
|
51 | 71 | }
|
52 | 72 |
|
53 | 73 | @Test
|
| 74 | + @Tag("task:3") |
| 75 | + @DisplayName("The reformat method correctly reformats an info log line") |
54 | 76 | public void info_reformat() {
|
55 | 77 | assertThat(LogLevels.reformat("[INFO]: Disk defragmented"))
|
56 | 78 | .isEqualTo("Disk defragmented (info)");
|
57 | 79 | }
|
58 | 80 |
|
59 | 81 | @Test
|
| 82 | + @Tag("task:3") |
| 83 | + @DisplayName("The reformat method correctly reformats an error log line removing spaces") |
60 | 84 | public void reformat_with_leading_and_trailing_white_space() {
|
61 | 85 | assertThat(LogLevels.reformat("[ERROR]: \t Corrupt disk\t \t \r\n"))
|
62 | 86 | .isEqualTo("Corrupt disk (error)");
|
|
0 commit comments