| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.configuration.internal; |
| 21 |
|
|
| 22 |
|
import static org.mockito.Mockito.when; |
| 23 |
|
|
| 24 |
|
import org.junit.Assert; |
| 25 |
|
import org.junit.Test; |
| 26 |
|
import org.xwiki.bridge.DocumentAccessBridge; |
| 27 |
|
import org.xwiki.configuration.internal.test.AbstractTestDocumentConfigurationSource; |
| 28 |
|
import org.xwiki.model.reference.DocumentReference; |
| 29 |
|
import org.xwiki.model.reference.LocalDocumentReference; |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
@link |
| 33 |
|
|
| 34 |
|
@version |
| 35 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 4 |
Complexity Density: 0.5 |
|
| 36 |
|
public class SpacePreferencesConfigurationSourceTest extends AbstractTestDocumentConfigurationSource |
| 37 |
|
{ |
| 38 |
|
private static final DocumentReference SPACE_DOCUMENT = new DocumentReference(CURRENT_WIKI, "currentspace", |
| 39 |
|
SpacePreferencesConfigurationSource.DOCUMENT_NAME); |
| 40 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 41 |
1 |
public SpacePreferencesConfigurationSourceTest()... |
| 42 |
|
{ |
| 43 |
1 |
super(SpacePreferencesConfigurationSource.class); |
| 44 |
|
} |
| 45 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 46 |
1 |
@Override... |
| 47 |
|
public void before() throws Exception |
| 48 |
|
{ |
| 49 |
1 |
super.before(); |
| 50 |
|
|
| 51 |
1 |
DocumentAccessBridge documentAccessBridge = this.componentManager.getInstance(DocumentAccessBridge.class); |
| 52 |
1 |
when(documentAccessBridge.getCurrentDocumentReference()).thenReturn(SPACE_DOCUMENT); |
| 53 |
|
} |
| 54 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 55 |
3 |
@Override... |
| 56 |
|
protected LocalDocumentReference getClassReference() |
| 57 |
|
{ |
| 58 |
3 |
return SpacePreferencesConfigurationSource.CLASS_REFERENCE; |
| 59 |
|
} |
| 60 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
| 61 |
1 |
@Test... |
| 62 |
|
public void getPropertyForStringWhenExists() throws Exception |
| 63 |
|
{ |
| 64 |
1 |
setStringProperty(SPACE_DOCUMENT, "key", "value"); |
| 65 |
|
|
| 66 |
1 |
String result = this.componentManager.getComponentUnderTest().getProperty("key", String.class); |
| 67 |
|
|
| 68 |
1 |
Assert.assertEquals("value", result); |
| 69 |
|
} |
| 70 |
|
} |