1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.logging.event; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
|
24 |
|
import org.apache.commons.lang3.ArrayUtils; |
25 |
|
import org.junit.Assert; |
26 |
|
import org.junit.Test; |
27 |
|
import org.xwiki.logging.LogLevel; |
28 |
|
import org.xwiki.logging.LogQueue; |
29 |
|
|
30 |
|
|
31 |
|
@link |
32 |
|
|
33 |
|
@version |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
|
35 |
|
public class LogEventTest |
36 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
37 |
1 |
@Test... |
38 |
|
public void testGetMessageElements() |
39 |
|
{ |
40 |
1 |
LogEvent logEvent = new LogEvent(null, LogLevel.ERROR, "", null, null); |
41 |
|
|
42 |
1 |
Assert.assertEquals(logEvent.getMessageElements(), Arrays.asList("")); |
43 |
|
|
44 |
1 |
logEvent = new LogEvent(null, LogLevel.ERROR, "", ArrayUtils.EMPTY_OBJECT_ARRAY, null); |
45 |
|
|
46 |
1 |
Assert.assertEquals(logEvent.getMessageElements(), Arrays.asList("")); |
47 |
|
|
48 |
1 |
logEvent = new LogEvent(null, LogLevel.ERROR, "message", ArrayUtils.EMPTY_OBJECT_ARRAY, null); |
49 |
|
|
50 |
1 |
Assert.assertEquals(logEvent.getMessageElements(), Arrays.asList("message")); |
51 |
|
|
52 |
1 |
logEvent = new LogEvent(null, LogLevel.ERROR, "message {}", new Object[] { "" }, null); |
53 |
|
|
54 |
1 |
Assert.assertEquals(logEvent.getMessageElements(), Arrays.asList("message ", "")); |
55 |
|
} |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
57 |
1 |
@Test... |
58 |
|
public void testLogLogger() |
59 |
|
{ |
60 |
1 |
LogEvent logEvent = new LogEvent(null, LogLevel.ERROR, "message", null, null); |
61 |
|
|
62 |
1 |
LogQueue queue = new LogQueue(); |
63 |
|
|
64 |
1 |
logEvent.log(queue); |
65 |
|
|
66 |
1 |
Assert.assertEquals(logEvent.getMessage(), "message"); |
67 |
|
} |
68 |
|
} |