aboutsummaryrefslogtreecommitdiffstats
path: root/core/core-protocols/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-24 13:20:26 -0400
committerJim Hahn <jrh3@att.com>2021-08-24 15:51:34 -0400
commitdc101c2ad5e27d5a0afd4e2feeb8885f24728806 (patch)
tree939e6f3690d1a9c6e63c4226a85fbda8c238d65a /core/core-protocols/src
parent53fe02c107eae2f45abfee02e5b56a8ab3c09523 (diff)
Use CompareToBuilder
Also added lombok to test classes. Issue-ID: POLICY-3391 Change-Id: I9ecf479f3861a2e5211b037e885029d1719b6a56 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'core/core-protocols/src')
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java59
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java6
2 files changed, 14 insertions, 51 deletions
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java
index 3d15a8c01..876052296 100644
--- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,60 +22,20 @@
package org.onap.policy.apex.core.protocols;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+
/**
* Dummy action for testing.
*/
+@Getter
+@Setter
+@EqualsAndHashCode
+@AllArgsConstructor
public class DummyAction implements Action {
private static final long serialVersionUID = 9178856761163651594L;
private String actionString = "An Action String";
-
- public DummyAction(final String actionString) {
- this.actionString = actionString;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getActionString() {
- return actionString;
- }
-
- public void setActionString(final String actionString) {
- this.actionString = actionString;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((actionString == null) ? 0 : actionString.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null) {
- return false;
- }
-
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- DummyAction other = (DummyAction) obj;
- if (actionString == null) {
- if (other.actionString != null) {
- return false;
- }
- } else if (!actionString.equals(other.actionString)) {
- return false;
- }
- return true;
- }
}
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
index f275f4b79..7bc352025 100644
--- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
@@ -22,6 +22,7 @@
package org.onap.policy.apex.core.protocols;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
@@ -41,8 +42,9 @@ public class SupportMessageTester {
DummyMessage dummyMessage = new DummyMessage(new DummyAction(null), new AxArtifactKey("Target:0.0.1"));
assertEquals(new DummyAction(null), dummyMessage.getAction());
- assertEquals("Message(action=org.onap.policy.apex.core.protocols.DummyAction@1f, "
- + "targetKey=AxArtifactKey:(name=Target,version=0.0.1), messageData=null)", dummyMessage.toString());
+ assertThat(dummyMessage.toString())
+ .startsWith("Message(action=org.onap.policy.apex.core.protocols.DummyAction@")
+ .endsWith("targetKey=AxArtifactKey:(name=Target,version=0.0.1), messageData=null)");
dummyMessage.setMessageData("Message Data");
assertEquals("Message Data", dummyMessage.getMessageData());