aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2023-09-29 09:05:58 +0100
committeradheli.tavares <adheli.tavares@est.tech>2023-09-29 09:10:44 +0100
commit1a5032107cd4ace7d028ef5ec4723e580d744a80 (patch)
treebefa98dc2c1b2e5d7745317e49a59e18befb8d6a /main/src/test
parent42c18ef1c6506e63151b55a96d90362da9fbda63 (diff)
Fix sonar code smells
Issue-ID: POLICY-4832 Change-Id: Icb8013fe566e9cb265f5b75340d4bb51211a890a Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'main/src/test')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java54
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/comm/msgdata/StateChangeReqTest.java12
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java4
3 files changed, 35 insertions, 35 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java
index f4be1409..3d8dc0aa 100644
--- a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java
@@ -77,7 +77,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testRequest_InvalidArgs() {
+ void testRequest_InvalidArgs() {
// null params
assertThatThrownBy(() -> new MyRequest(null, MY_REQ_NAME, msg)).isInstanceOf(NullPointerException.class);
@@ -92,13 +92,13 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testReconfigure2_WrongMsgClass() {
+ void testReconfigure2_WrongMsgClass() {
assertThatIllegalArgumentException().isThrownBy(() -> req.reconfigure(new PdpUpdate()))
.withMessage("expecting PdpStateChange instead of PdpUpdate");
}
@Test
- public void testReconfigure2_NotPublishing() {
+ void testReconfigure2_NotPublishing() {
// replace the message with a new message
req.reconfigure(new PdpStateChange());
@@ -108,7 +108,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testRequestImpl_testReconfigure2_Publishing() {
+ void testRequestImpl_testReconfigure2_Publishing() {
req.startPublishing();
// replace the message with a new message
@@ -135,7 +135,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testIsPublishing() {
+ void testIsPublishing() {
assertFalse(req.isPublishing());
req.startPublishing();
@@ -146,14 +146,14 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testStartPublishingQueueToken_NoListener() {
+ void testStartPublishingQueueToken_NoListener() {
req.setListener(null);
assertThatIllegalStateException().isThrownBy(() -> req.startPublishing())
.withMessage("listener has not been set");
}
@Test
- public void testStartPublishing() {
+ void testStartPublishing() {
req.startPublishing();
assertTrue(req.isPublishing());
@@ -176,7 +176,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testStopPublishing() {
+ void testStopPublishing() {
// not publishing yet
req.stopPublishing();
assertFalse(req.isPublishing());
@@ -197,13 +197,13 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testStopPublishingBoolean_NotPublishing() {
+ void testStopPublishingBoolean_NotPublishing() {
// should not throw an exception
Assertions.assertThatCode(() -> req.stopPublishing()).doesNotThrowAnyException();
}
@Test
- public void testStopPublishingBoolean_TruePublishing() {
+ void testStopPublishingBoolean_TruePublishing() {
req.startPublishing();
req.stopPublishing();
@@ -225,7 +225,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testEnqueue() {
+ void testEnqueue() {
req.startPublishing();
// replace the message with a new message
@@ -267,7 +267,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testResetRetryCount_testBumpRetryCount() {
+ void testResetRetryCount_testBumpRetryCount() {
req = new MyRequest(new RequestParams().setMaxRetryCount(2).setModifyLock(lock).setPdpPublisher(publisher)
.setResponseDispatcher(dispatcher).setTimers(timers), MY_REQ_NAME, msg);
req.setListener(listener);
@@ -287,7 +287,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testProcessResponse() {
+ void testProcessResponse() {
req.startPublishing();
invokeProcessResponse(response);
@@ -298,7 +298,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testProcessResponse_NotPublishing() {
+ void testProcessResponse_NotPublishing() {
// force registration with the dispatcher - needed by invokeProcessResponse(response)
req.startPublishing();
req.stopPublishing();
@@ -310,7 +310,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testProcessResponse_WrongRequest() {
+ void testProcessResponse_WrongRequest() {
req.startPublishing();
response.getResponse().setResponseTo(DIFFERENT);
@@ -323,7 +323,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testProcessResponse_ResponseFailed() {
+ void testProcessResponse_ResponseFailed() {
req.startPublishing();
response.setName(DIFFERENT);
@@ -336,7 +336,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testHandleTimeout() {
+ void testHandleTimeout() {
req.startPublishing();
// remove it from the queue
@@ -352,7 +352,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testHandleTimeout_NotPublishing() {
+ void testHandleTimeout_NotPublishing() {
req.startPublishing();
req.stopPublishing();
@@ -365,7 +365,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testHandleTimeout_RetryExhausted() {
+ void testHandleTimeout_RetryExhausted() {
req.startPublishing();
// exhaust the count
@@ -385,7 +385,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testCheckResponse_Matched() {
+ void testCheckResponse_Matched() {
req.startPublishing();
invokeProcessResponse(response);
@@ -395,7 +395,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testCheckResponse_NullName() {
+ void testCheckResponse_NullName() {
req.startPublishing();
response.setName(null);
@@ -407,7 +407,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testCheckResponse_MismatchedName() {
+ void testCheckResponse_MismatchedName() {
req.startPublishing();
response.setName(DIFFERENT);
@@ -419,7 +419,7 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testCheckResponse_MismatchedNameWithBroadcast() {
+ void testCheckResponse_MismatchedNameWithBroadcast() {
msg.setName(null);
req.startPublishing();
@@ -432,12 +432,12 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testGetName() {
+ void testGetName() {
assertEquals(MY_REQ_NAME, req.getName());
}
@Test
- public void testGetMessage() {
+ void testGetMessage() {
assertSame(msg, req.getMessage());
PdpStateChange msg2 = new PdpStateChange();
@@ -446,12 +446,12 @@ class RequestImplTest extends CommonRequestBase {
}
@Test
- public void testGetParams() {
+ void testGetParams() {
assertSame(reqParams, req.getParams());
}
@Test
- public void testGetUndeployPolicies() {
+ void testGetUndeployPolicies() {
assertTrue(req.getUndeployPolicies().isEmpty());
}
diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/StateChangeReqTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/StateChangeReqTest.java
index 7cf731d4..1ec23356 100644
--- a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/StateChangeReqTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/StateChangeReqTest.java
@@ -63,39 +63,39 @@ class StateChangeReqTest extends CommonRequestBase {
}
@Test
- public void testGetMessage() {
+ void testGetMessage() {
assertEquals(MY_REQ_NAME, data.getName());
assertSame(msg, data.getMessage());
}
@Test
- public void testCheckResponse() {
+ void testCheckResponse() {
assertNull(data.checkResponse(response));
}
@Test
- public void testCheckResponse_NullName() {
+ void testCheckResponse_NullName() {
response.setName(null);
assertEquals("null PDP name", data.checkResponse(response));
}
@Test
- public void testCheckResponse_NullMsgName() {
+ void testCheckResponse_NullMsgName() {
msg.setName(null);
assertNull(data.checkResponse(response));
}
@Test
- public void testCheckResponse_MismatchedState() {
+ void testCheckResponse_MismatchedState() {
response.setState(DIFF_STATE);
assertEquals("state is TERMINATED, but expected SAFE", data.checkResponse(response));
}
@Test
- public void testReconfigure() {
+ void testReconfigure() {
// different message type should fail and leave message unchanged
assertFalse(data.reconfigure(new PdpUpdate()));
assertSame(msg, data.getMessage());
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java
index e7fc09c6..9b4239bb 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/e2e/PdpGroupCreateOrUpdateTest.java
@@ -88,7 +88,7 @@ class PdpGroupCreateOrUpdateTest extends End2EndBase {
createPdpGroups("createGroups.yaml", "application/yaml");
}
- private void createPdpGroups(String fileName, String mediaType) throws Exception, InterruptedException {
+ private void createPdpGroups(String fileName, String mediaType) throws Exception {
context.addPdp("pdpAA_1", CREATE_SUBGROUP);
context.addPdp("pdpAA_2", CREATE_SUBGROUP);
context.addPdp("pdpAB_1", "pdpTypeB");
@@ -127,7 +127,7 @@ class PdpGroupCreateOrUpdateTest extends End2EndBase {
}
@Test
- public void testCreateAndUpdate_MultipleGroups() throws Exception {
+ void testCreateAndUpdate_MultipleGroups() throws Exception {
Invocation.Builder invocationBuilderForGroupUpdate = sendRequest(CREATEORUPDATE_GROUPS_ENDPOINT);