| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.uiextension; |
| 21 |
|
|
| 22 |
|
import static org.junit.Assert.assertEquals; |
| 23 |
|
import static org.mockito.Mockito.when; |
| 24 |
|
|
| 25 |
|
import java.util.Arrays; |
| 26 |
|
import java.util.HashSet; |
| 27 |
|
|
| 28 |
|
import org.junit.Rule; |
| 29 |
|
import org.junit.Test; |
| 30 |
|
import org.xwiki.component.internal.ContextComponentManagerProvider; |
| 31 |
|
import org.xwiki.test.annotation.ComponentList; |
| 32 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
| 33 |
|
import org.xwiki.uiextension.internal.DefaultUIExtensionManager; |
| 34 |
|
|
| 35 |
|
@ComponentList(ContextComponentManagerProvider.class) |
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.12 |
|
| 36 |
|
public class UIExtensionManagerTest |
| 37 |
|
{ |
| 38 |
|
@Rule |
| 39 |
|
public MockitoComponentMockingRule<UIExtensionManager> mocker = |
| 40 |
|
new MockitoComponentMockingRule<UIExtensionManager>(DefaultUIExtensionManager.class); |
| 41 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
| 42 |
1 |
@Test... |
| 43 |
|
public void testGet() throws Exception |
| 44 |
|
{ |
| 45 |
1 |
assertEquals(Arrays.asList(), this.mocker.getComponentUnderTest().get("extensionpoint")); |
| 46 |
|
|
| 47 |
1 |
UIExtension uix1 = mocker.registerMockComponent(UIExtension.class, "uix1"); |
| 48 |
1 |
when(uix1.getExtensionPointId()).thenReturn("extensionpoint"); |
| 49 |
|
|
| 50 |
1 |
UIExtension uix2 = mocker.registerMockComponent(UIExtension.class, "uix2"); |
| 51 |
1 |
when(uix2.getExtensionPointId()).thenReturn("extensionpoint"); |
| 52 |
|
|
| 53 |
1 |
UIExtension notuix = mocker.registerMockComponent(UIExtension.class, "notuix"); |
| 54 |
1 |
when(notuix.getExtensionPointId()).thenReturn("notuix"); |
| 55 |
|
|
| 56 |
1 |
assertEquals(new HashSet<UIExtension>(Arrays.asList(uix1, uix2)), new HashSet<UIExtension>(this.mocker |
| 57 |
|
.getComponentUnderTest().get("extensionpoint"))); |
| 58 |
|
} |
| 59 |
|
} |