| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package com.xpn.xwiki.objects; |
| 21 |
|
|
| 22 |
|
import org.junit.Assert; |
| 23 |
|
import org.junit.Before; |
| 24 |
|
import org.junit.Rule; |
| 25 |
|
import org.junit.Test; |
| 26 |
|
import org.xwiki.model.internal.reference.LocalStringEntityReferenceSerializer; |
| 27 |
|
import org.xwiki.test.ComponentManagerRule; |
| 28 |
|
import org.xwiki.test.annotation.ComponentList; |
| 29 |
|
|
| 30 |
|
import com.xpn.xwiki.web.Utils; |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
@link |
| 34 |
|
|
| 35 |
|
@version |
| 36 |
|
@since |
| 37 |
|
|
| 38 |
|
@ComponentList({LocalStringEntityReferenceSerializer.class}) |
| |
|
| 100% |
Uncovered Elements: 0 (38) |
Complexity: 6 |
Complexity Density: 0.19 |
|
| 39 |
|
public class NumberPropertyTest |
| 40 |
|
{ |
| 41 |
|
@Rule |
| 42 |
|
public ComponentManagerRule componentManager = new ComponentManagerRule(); |
| 43 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 44 |
5 |
@Before... |
| 45 |
|
public void setup() |
| 46 |
|
{ |
| 47 |
5 |
Utils.setComponentManager(this.componentManager); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 54 |
1 |
@Test... |
| 55 |
|
public void nullValueEqualsWithOtherNumberProperty() |
| 56 |
|
{ |
| 57 |
1 |
NumberProperty nullValueProperty = new IntegerProperty(); |
| 58 |
1 |
nullValueProperty.setValue(null); |
| 59 |
1 |
Assert.assertNull(nullValueProperty.getValue()); |
| 60 |
|
|
| 61 |
1 |
NumberProperty notNullValueProperty = new IntegerProperty(); |
| 62 |
1 |
notNullValueProperty.setValue(1); |
| 63 |
1 |
Assert.assertNotNull(notNullValueProperty.getValue()); |
| 64 |
|
|
| 65 |
|
|
| 66 |
1 |
Assert.assertFalse(nullValueProperty.equals(notNullValueProperty)); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 73 |
1 |
@Test... |
| 74 |
|
public void notNullValueEqualsWithOtherNullNumberProperty() |
| 75 |
|
{ |
| 76 |
1 |
NumberProperty nullValueProperty = new IntegerProperty(); |
| 77 |
1 |
nullValueProperty.setValue(1); |
| 78 |
1 |
Assert.assertNotNull(nullValueProperty.getValue()); |
| 79 |
|
|
| 80 |
1 |
NumberProperty notNullValueProperty = new IntegerProperty(); |
| 81 |
1 |
notNullValueProperty.setValue(null); |
| 82 |
1 |
Assert.assertNull(notNullValueProperty.getValue()); |
| 83 |
|
|
| 84 |
|
|
| 85 |
1 |
Assert.assertFalse(nullValueProperty.equals(notNullValueProperty)); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 92 |
1 |
@Test... |
| 93 |
|
public void equalNullValueEquals() |
| 94 |
|
{ |
| 95 |
1 |
NumberProperty nullValueProperty1 = new IntegerProperty(); |
| 96 |
1 |
nullValueProperty1.setValue(null); |
| 97 |
1 |
Assert.assertNull(nullValueProperty1.getValue()); |
| 98 |
|
|
| 99 |
1 |
NumberProperty nullValueProperty2 = new IntegerProperty(); |
| 100 |
1 |
nullValueProperty2.setValue(null); |
| 101 |
1 |
Assert.assertNull(nullValueProperty2.getValue()); |
| 102 |
|
|
| 103 |
|
|
| 104 |
1 |
Assert.assertTrue(nullValueProperty1.equals(nullValueProperty2)); |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 110 |
1 |
@Test... |
| 111 |
|
public void equalNotNullValues() |
| 112 |
|
{ |
| 113 |
1 |
NumberProperty nullValueProperty = new IntegerProperty(); |
| 114 |
1 |
nullValueProperty.setValue(1); |
| 115 |
|
|
| 116 |
1 |
NumberProperty notNullValueProperty = new IntegerProperty(); |
| 117 |
1 |
notNullValueProperty.setValue(1); |
| 118 |
|
|
| 119 |
1 |
Assert.assertTrue(nullValueProperty.equals(notNullValueProperty)); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 125 |
1 |
@Test... |
| 126 |
|
public void notEqualNonNullValues() |
| 127 |
|
{ |
| 128 |
1 |
NumberProperty nullValueProperty = new IntegerProperty(); |
| 129 |
1 |
nullValueProperty.setValue(0); |
| 130 |
|
|
| 131 |
1 |
NumberProperty notNullValueProperty = new IntegerProperty(); |
| 132 |
1 |
notNullValueProperty.setValue(1); |
| 133 |
|
|
| 134 |
1 |
Assert.assertFalse(nullValueProperty.equals(notNullValueProperty)); |
| 135 |
|
} |
| 136 |
|
} |