summaryrefslogtreecommitdiffstats
path: root/context/context-test-utils/src
diff options
context:
space:
mode:
Diffstat (limited to 'context/context-test-utils/src')
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java40
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java38
2 files changed, 45 insertions, 33 deletions
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java
index e801ae786..49802c2da 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ArtifactKeyTestEntity.java
@@ -28,9 +28,9 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
@Entity
@@ -59,10 +59,12 @@ public class ArtifactKeyTestEntity extends AxConcept {
this.doubleValue = doubleValue;
}
+ @Override
public AxArtifactKey getKey() {
return key;
}
+ @Override
public List<AxKey> getKeys() {
return Arrays.asList((AxKey) getKey());
}
@@ -125,38 +127,42 @@ public class ArtifactKeyTestEntity extends AxConcept {
@Override
public boolean equals(final Object obj) {
- if (obj == null)
+ if (obj == null) {
return false;
- if (this == obj)
+ }
+ if (this == obj) {
return true;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) obj;
if (key == null) {
- if (other.key != null)
+ if (other.key != null) {
return false;
- } else if (!key.equals(other.key))
- return false;
- if (doubleValue != other.doubleValue)
+ }
+ } else if (!key.equals(other.key)) {
return false;
- return true;
+ }
+ return (Double.compare(doubleValue, other.doubleValue) == 0);
}
@Override
public int compareTo(final AxConcept otherObj) {
- if (otherObj == null)
+ if (otherObj == null) {
return -1;
- if (this == otherObj)
+ }
+ if (this == otherObj) {
return 0;
+ }
final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) otherObj;
if (key == null) {
- if (other.key != null)
+ if (other.key != null) {
return 1;
- } else if (!key.equals(other.key))
+ }
+ } else if (!key.equals(other.key)) {
return key.compareTo(other.key);
- if (doubleValue != other.doubleValue)
- return new Double(doubleValue).compareTo(other.doubleValue);
-
- return 0;
+ }
+ return Double.compare(doubleValue, other.doubleValue);
}
}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java
index 14c3628e5..6f276335b 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/entities/ReferenceKeyTestEntity.java
@@ -62,10 +62,12 @@ public class ReferenceKeyTestEntity extends AxConcept {
this.doubleValue = doubleValue;
}
+ @Override
public AxReferenceKey getKey() {
return key;
}
+ @Override
public List<AxKey> getKeys() {
return Arrays.asList((AxKey) getKey());
}
@@ -128,38 +130,42 @@ public class ReferenceKeyTestEntity extends AxConcept {
@Override
public boolean equals(final Object obj) {
- if (obj == null)
+ if (obj == null) {
return false;
- if (this == obj)
+ }
+ if (this == obj) {
return true;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) obj;
if (key == null) {
- if (other.key != null)
+ if (other.key != null) {
return false;
- } else if (!key.equals(other.key))
- return false;
- if (doubleValue != other.doubleValue)
+ }
+ } else if (!key.equals(other.key)) {
return false;
- return true;
+ }
+ return (Double.compare(doubleValue, other.doubleValue) == 0);
}
@Override
public int compareTo(final AxConcept otherObj) {
- if (otherObj == null)
+ if (otherObj == null) {
return -1;
- if (this == otherObj)
+ }
+ if (this == otherObj) {
return 0;
+ }
final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) otherObj;
if (key == null) {
- if (other.key != null)
+ if (other.key != null) {
return 1;
- } else if (!key.equals(other.key))
+ }
+ } else if (!key.equals(other.key)) {
return key.compareTo(other.key);
- if (doubleValue != other.doubleValue)
- return new Double(doubleValue).compareTo(other.doubleValue);
-
- return 0;
+ }
+ return Double.compare(doubleValue, other.doubleValue);
}
}