Fix Sonar issues 14/121414/3
authorelinuxhenrik <henrik.b.andersson@est.tech>
Mon, 7 Jun 2021 09:14:41 +0000 (11:14 +0200)
committerelinuxhenrik <henrik.b.andersson@est.tech>
Mon, 7 Jun 2021 09:14:41 +0000 (11:14 +0200)
Issue-ID: CCSDK-3255
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Change-Id: Iaf070882fac078d3441748b6dfc7218b1ac1ab31

a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/repository/Services.java
a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java

index 2d2f636..68a8d7d 100644 (file)
@@ -52,11 +52,11 @@ public class Services {
     }
 
     public synchronized Service getService(String name) throws ServiceException {
-        Service s = registeredServices.get(name);
-        if (s == null) {
+        Service service = registeredServices.get(name);
+        if (service == null) {
             throw new ServiceException("Could not find service: " + name);
         }
-        return s;
+        return service;
     }
 
     public synchronized Service get(String name) {
@@ -80,7 +80,7 @@ public class Services {
             try {
                 Files.delete(getPath(service));
             } catch (Exception e) {
-
+                // Doesn't matter.
             }
         }
     }
index 9c9331d..ab9b726 100644 (file)
@@ -249,7 +249,7 @@ class ApplicationTest {
         // check that the service can be deleted
         this.services.remove(SERVICE);
         servicesRestored = new Services(this.applicationConfig);
-        assertThat(servicesRestored.size()).isEqualTo(0);
+        assertThat(servicesRestored.size()).isZero();
     }
 
     @Test
@@ -271,7 +271,7 @@ class ApplicationTest {
 
         // Test that the type has been synched
         Ric addedRic = this.rics.getRic(RIC);
-        assertThat(addedRic.getSupportedPolicyTypes().size()).isEqualTo(1);
+        assertThat(addedRic.getSupportedPolicyTypes()).hasSize(1);
         assertThat(addedRic.getSupportedPolicyTypes().iterator().next().getId()).isEqualTo(TYPE);
 
         // Check that a service callback for the AVAILABLE RIC is invoked
@@ -298,9 +298,9 @@ class ApplicationTest {
 
         // Check that no service callback for the UNAVAILABLE RIC is invoked
         RappSimulatorController.TestResults receivedCallbacks = rAppSimulator.getTestResults();
-        assertThat(receivedCallbacks.getReceivedInfo().size()).isEqualTo(0);
+        assertThat(receivedCallbacks.getReceivedInfo()).isEmpty();
 
-        // Run a synch and check that the AVAILABLE notificationis received
+        // Run a synch and check that the AVAILABLE notification is received
         a1ClientFactory.reset();
         supervision.checkAllRics();
         waitForRicState(RIC, RicState.AVAILABLE);