1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.internal.render; |
21 |
|
|
22 |
|
import javax.inject.Provider; |
23 |
|
|
24 |
|
import org.junit.Rule; |
25 |
|
import org.junit.Test; |
26 |
|
import org.xwiki.component.descriptor.DefaultComponentDescriptor; |
27 |
|
import org.xwiki.component.internal.ContextComponentManagerProvider; |
28 |
|
import org.xwiki.test.annotation.ComponentList; |
29 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
30 |
|
|
31 |
|
import static org.junit.Assert.assertNotSame; |
32 |
|
import static org.junit.Assert.assertSame; |
33 |
|
|
34 |
|
|
35 |
|
@link |
36 |
|
|
37 |
|
@version |
38 |
|
|
39 |
|
@ComponentList(ContextComponentManagerProvider.class) |
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.11 |
|
40 |
|
public class OldRenderingProviderTest |
41 |
|
{ |
42 |
|
@Rule |
43 |
|
public MockitoComponentMockingRule<Provider<OldRendering>> mocker = |
44 |
|
new MockitoComponentMockingRule<Provider<OldRendering>>(OldRenderingProvider.class); |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
46 |
1 |
@Test... |
47 |
|
public void testInstallNewOldCoreRendering() throws Exception |
48 |
|
{ |
49 |
1 |
OldRendering oldRendering1 = this.mocker.registerMockComponent(OldRendering.class); |
50 |
|
|
51 |
1 |
assertSame(oldRendering1, this.mocker.getComponentUnderTest().get()); |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
1 |
OldRendering oldRendering2 = this.mocker.registerMockComponent(OldRendering.class); |
56 |
1 |
assertNotSame(oldRendering1, oldRendering2); |
57 |
|
|
58 |
1 |
DefaultComponentDescriptor<OldRendering> componentDescriptor = new DefaultComponentDescriptor<OldRendering>(); |
59 |
1 |
componentDescriptor.setImplementation(oldRendering2.getClass()); |
60 |
1 |
componentDescriptor.setRoleType(OldRendering.class); |
61 |
1 |
((OldRenderingProvider) this.mocker.getComponentUnderTest()) |
62 |
|
.onNewOldRendering(componentDescriptor, this.mocker); |
63 |
|
|
64 |
1 |
assertSame(oldRendering2, this.mocker.getComponentUnderTest().get()); |
65 |
|
} |
66 |
|
} |