diff options
Diffstat (limited to 'testsuites/integration/integration-context-test')
2 files changed, 10 insertions, 16 deletions
diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ArtifactKeyTestEntity.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ArtifactKeyTestEntity.java index 3b8394dbb..500405422 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ArtifactKeyTestEntity.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ArtifactKeyTestEntity.java @@ -33,6 +33,7 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import lombok.ToString; +import org.apache.commons.lang3.builder.CompareToBuilder; 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; @@ -143,13 +144,9 @@ public class ArtifactKeyTestEntity extends AxConcept { return -1; } final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) otherObj; - if (key == null) { - if (other.key != null) { - return 1; - } - } else if (!key.equals(other.key)) { - return key.compareTo(other.key); - } - return Double.compare(doubleValue, other.doubleValue); + return new CompareToBuilder() + .append(key, other.key) + .append(doubleValue, other.doubleValue) + .toComparison(); } } diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ReferenceKeyTestEntity.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ReferenceKeyTestEntity.java index da478f0dd..a8b90d17a 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ReferenceKeyTestEntity.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/entities/ReferenceKeyTestEntity.java @@ -34,6 +34,7 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import lombok.ToString; +import org.apache.commons.lang3.builder.CompareToBuilder; 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.AxReferenceKey; @@ -146,13 +147,9 @@ public class ReferenceKeyTestEntity extends AxConcept { return -1; } final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) otherObj; - if (key == null) { - if (other.key != null) { - return 1; - } - } else if (!key.equals(other.key)) { - return key.compareTo(other.key); - } - return Double.compare(doubleValue, other.doubleValue); + return new CompareToBuilder() + .append(key, other.key) + .append(doubleValue, other.doubleValue) + .toComparison(); } } |