diff options
author | Tomasz Golabek <tomasz.golabek@nokia.com> | 2019-09-03 13:08:37 +0200 |
---|---|---|
committer | Tomasz Golabek <tomasz.golabek@nokia.com> | 2019-09-03 12:48:51 +0000 |
commit | a1cbd053c05862df04517ad2e9268c7d9999afd6 (patch) | |
tree | 82c10dc7ebfa406477068f21195bb04664fcbcb8 /openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java | |
parent | fac210b761cd132dce05392325123b67aec10b23 (diff) |
unit tests - openecomp-sdc
Additional junit tests for action, type etc.
Change-Id: I93b088035fca13db4fdcf9da0d58e7f01ee4f976
Issue-ID: SDC-2326
Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java')
2 files changed, 8 insertions, 11 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java index b7d5568c8c..672a27ae34 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java @@ -14,7 +14,6 @@ * limitations under the License. */ - package org.openecomp.sdc.action.types; import java.util.Date; @@ -28,6 +27,7 @@ import org.openecomp.sdc.action.ActionConstants; import org.openecomp.sdc.action.dao.types.ActionEntity; import org.openecomp.sdc.versioning.dao.types.Version; + public class Action implements Comparable { private String actionUuId; private String actionInvariantUuId; @@ -249,6 +249,7 @@ public class Action implements Comparable { @Override public boolean equals(Object o) { + if (this == o) { return true; } @@ -258,17 +259,15 @@ public class Action implements Comparable { Action action = (Action) o; - if (!version.equals(action.version)) { + if (!Objects.equals(version, action.version)) { return false; } - return name.equals(action.name); + return Objects.equals(name, action.name); } @Override public int hashCode() { - int result = version.hashCode(); - result = 31 * result + name.hashCode(); - return result; + return com.google.common.base.Objects.hashCode(version, name); } } diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java index dd30b681e9..ff4d908ed2 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java @@ -21,12 +21,12 @@ package org.openecomp.sdc.action.types; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.google.common.base.Objects; import org.openecomp.sdc.action.dao.types.ActionArtifactEntity; import java.nio.ByteBuffer; import java.util.Date; - public class ActionArtifact { private String artifactUuId; @@ -131,15 +131,13 @@ public class ActionArtifact { public boolean equals(Object obj) { if (obj instanceof ActionArtifact) { ActionArtifact temp = (ActionArtifact) obj; - if (artifactUuId.equals(temp.getArtifactUuId())) { - return true; - } + return Objects.equal(artifactUuId, temp.getArtifactUuId()); } return false; } @Override public int hashCode() { - return artifactUuId.hashCode(); + return Objects.hashCode(artifactUuId); } } |