1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.observation; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import org.junit.Assert; |
26 |
|
import org.junit.Test; |
27 |
|
import org.xwiki.observation.event.ActionExecutionEvent; |
28 |
|
import org.xwiki.observation.event.Event; |
29 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
30 |
|
public class EventListenerTest |
31 |
|
{ |
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 3 |
Complexity Density: 1.5 |
|
32 |
|
static class TestEventListener extends AbstractEventListener |
33 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
34 |
1 |
public TestEventListener(String name, List<? extends Event> events)... |
35 |
|
{ |
36 |
1 |
super(name, events); |
37 |
|
} |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
1 |
public TestEventListener(String name, Event... events)... |
40 |
|
{ |
41 |
1 |
super(name, events); |
42 |
|
} |
43 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
44 |
0 |
@Override... |
45 |
|
public void onEvent(Event event, Object source, Object data) |
46 |
|
{ |
47 |
|
} |
48 |
|
} |
49 |
|
|
50 |
|
|
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
52 |
1 |
@Test... |
53 |
|
public void testAbstractEventListenerArray() |
54 |
|
{ |
55 |
1 |
TestEventListener listener = |
56 |
|
new TestEventListener("name", new ActionExecutionEvent("action1"), new ActionExecutionEvent("action2")); |
57 |
|
|
58 |
1 |
Assert.assertEquals("name", listener.getName()); |
59 |
1 |
Assert.assertEquals(Arrays.asList(new ActionExecutionEvent("action1"), new ActionExecutionEvent("action2")), |
60 |
|
listener.getEvents()); |
61 |
|
} |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
63 |
1 |
@Test... |
64 |
|
public void testAbstractEventListenerList() |
65 |
|
{ |
66 |
1 |
TestEventListener listener = |
67 |
|
new TestEventListener("name", Arrays.asList(new ActionExecutionEvent("action1"), new ActionExecutionEvent( |
68 |
|
"action2"))); |
69 |
|
|
70 |
1 |
Assert.assertEquals("name", listener.getName()); |
71 |
1 |
Assert.assertEquals(Arrays.asList(new ActionExecutionEvent("action1"), new ActionExecutionEvent("action2")), |
72 |
|
listener.getEvents()); |
73 |
|
} |
74 |
|
} |