aboutsummaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src/test/java/org
diff options
context:
space:
mode:
authorelinuxhenrik <henrik.b.andersson@est.tech>2020-08-24 14:18:33 +0200
committerHenrik Andersson <henrik.b.andersson@est.tech>2020-08-24 14:08:24 +0000
commit749f96c4c4877bee554b4cf7d5d696e3e88c0af8 (patch)
tree8997822f49e734d83f4fa3056bc2f09d54d8dc77 /a1-policy-management/src/test/java/org
parentc4d1f8ad32a1a5e12780b30f32a64256a3c0b0f1 (diff)
Fix Sonar issues
Change-Id: I868d22847853ba7646164c2234b608ec319085ab Issue-ID: CCSDK-2502 Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Diffstat (limited to 'a1-policy-management/src/test/java/org')
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/ApplicationTestV2.java4
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1ClientTest.java11
2 files changed, 7 insertions, 8 deletions
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/ApplicationTestV2.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/ApplicationTestV2.java
index bc47baf9..3a7068d6 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/ApplicationTestV2.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/ApplicationTestV2.java
@@ -500,12 +500,12 @@ class ApplicationTestV2 {
url = "/policy-schemas?ric_id=ric1&policytype_id=type1";
rsp = restClient().get(url).block();
PolicySchemaList list = gson.fromJson(rsp, PolicySchemaList.class);
- assertThat(list.schemas.size()).isEqualTo(1);
+ assertThat(list.schemas).hasSize(1);
url = "/policy-schemas?ric_id=ric1&policytype_id=type2";
rsp = restClient().get(url).block();
list = gson.fromJson(rsp, PolicySchemaList.class);
- assertThat(list.schemas.size()).isEqualTo(0);
+ assertThat(list.schemas).isEmpty();
// Get schema for non existing RIC
url = "/policy-schemas?ric_id=ric1XXX";
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1ClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1ClientTest.java
index 1fc4a421..08e99847 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1ClientTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SdncOscA1ClientTest.java
@@ -22,6 +22,7 @@ package org.onap.ccsdk.oran.a1policymanagementservice.clients;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -95,12 +96,10 @@ class SdncOscA1ClientTest {
@Test
void createClientWithWrongProtocol_thenErrorIsThrown() {
- try {
- new SdncOscA1Client(A1ProtocolType.STD_V1_1, null, null, new AsyncRestClient("", null));
- fail("Should have thrown exception.");
- } catch (IllegalArgumentException e) {
- return;
- }
+ AsyncRestClient asyncRestClient = new AsyncRestClient("", null);
+ assertThrows(IllegalArgumentException.class, () -> {
+ new SdncOscA1Client(A1ProtocolType.STD_V1_1, null, null, asyncRestClient);
+ });
}
@Test