Code coverage and sonar fixes for ACM 38/138338/1
authorFrancescoFioraEst <francesco.fiora@est.tech>
Thu, 27 Jun 2024 12:04:21 +0000 (13:04 +0100)
committerFrancesco Fiora <francesco.fiora@est.tech>
Thu, 27 Jun 2024 13:21:58 +0000 (13:21 +0000)
Code coverage and sonar fixes in classes
that was not involved in recent implementations.

Issue-ID: POLICY-5065
Change-Id: Ib23da6f242b0a7eaa98f14abc6617ff9e12e10d9
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
15 files changed:
models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositions.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/concepts/DocToscaCapabilityAssignment.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/concepts/DocToscaEntity.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/concepts/DocToscaParameter.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/concepts/DocToscaProperty.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/concepts/DocToscaRequirement.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/concepts/DocToscaWithToscaProperties.java
models/src/main/java/org/onap/policy/clamp/models/acm/document/concepts/DocToscaWithTypeAndStringProperties.java
models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionsTest.java [new file with mode: 0644]
models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/StringToMapConverterTest.java [new file with mode: 0644]
models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/StringToServiceTemplateConverterTest.java [new file with mode: 0644]
participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessageHandlerTest.java
participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessagePublisherTest.java [new file with mode: 0644]
participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/rest/ActuatorControllerTest.java

index 1802f81..76443ab 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021,2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -40,9 +40,9 @@ public class AutomationCompositions {
     /**
      * Copy constructor, does a deep copy.
      *
-     * @param otherAutomationCompositions the other element to copy from
+     * @param other the other element to copy from
      */
-    public AutomationCompositions(final AutomationCompositions otherAutomationCompositions) {
-        this.automationCompositionList = PfUtils.mapList(automationCompositionList, AutomationComposition::new);
+    public AutomationCompositions(final AutomationCompositions other) {
+        this.automationCompositionList = PfUtils.mapList(other.automationCompositionList, AutomationComposition::new);
     }
 }
index 572332e..e675e23 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation.
+ *  Copyright (C) 2022,2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -42,7 +42,10 @@ public class DocToscaCapabilityAssignment extends DocToscaWithTypeAndStringPrope
     @Serial
     private static final long serialVersionUID = 1L;
 
+    @SuppressWarnings("squid:S1948")
     private Map<@NotNull String, @NotNull Object> attributes;
+
+    @SuppressWarnings("squid:S1948")
     private List<@NotNull Object> occurrences;
 
     /**
index c848465..b931d4e 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation.
+ *  Copyright (C) 2022,2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -59,6 +59,7 @@ public class DocToscaEntity<T extends ToscaEntity> extends Validated
     @SerializedName("derived_from")
     private String derivedFrom;
 
+    @SuppressWarnings("squid:S1948")
     private Map<@NotNull @NotBlank String, @NotNull @NotBlank Object> metadata = new LinkedHashMap<>();
 
     @NotBlank
index 2904962..5a252b8 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation.
+ *  Copyright (C) 2022,2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -48,6 +48,7 @@ public class DocToscaParameter implements PfAuthorative<ToscaParameter>, Seriali
     @SerializedName("type_version")
     private String typeVersion;
 
+    @SuppressWarnings("squid:S1948")
     private Object value;
 
     /**
index b47ef56..774f045 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation.
+ *  Copyright (C) 2022,2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -60,6 +60,7 @@ public class DocToscaProperty implements PfAuthorative<ToscaProperty>, Serializa
 
     @SerializedName("default")
     @NotBlank
+    @SuppressWarnings("squid:S1948")
     private Object defaultValue;
 
     private boolean required = false;
@@ -208,7 +209,7 @@ public class DocToscaProperty implements PfAuthorative<ToscaProperty>, Serializa
             return result;
         }
 
-        result = entrySchema.compareTo(other.entrySchema);
+        result = ObjectUtils.compare(entrySchema, other.entrySchema);
         if (result != 0) {
             return result;
         }
index fd67fb6..9d3cc10 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation.
+ *  Copyright (C) 2022,2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -42,6 +42,8 @@ public class DocToscaRequirement extends DocToscaWithTypeAndStringProperties<Tos
     private String capability;
     private String node;
     private String relationship;
+
+    @SuppressWarnings("squid:S1948")
     private List<Object> occurrences;
 
     public DocToscaRequirement(ToscaRequirement toscaRequirement) {
index 9a6d60c..bcb63a2 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation.
+ *  Copyright (C) 2022,2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@ import lombok.NoArgsConstructor;
 import lombok.NonNull;
 import org.apache.commons.collections4.CollectionUtils;
 import org.onap.policy.clamp.models.acm.document.base.DocConceptKey;
+import org.onap.policy.clamp.models.acm.document.base.DocUtil;
 import org.onap.policy.common.parameters.BeanValidationResult;
 import org.onap.policy.common.parameters.annotations.NotBlank;
 import org.onap.policy.common.parameters.annotations.NotNull;
@@ -49,6 +50,7 @@ public class DocToscaWithToscaProperties<T extends ToscaWithToscaProperties> ext
     @Serial
     private static final long serialVersionUID = 1L;
 
+    @SuppressWarnings("squid:S1948")
     private Map<@NotNull @NotBlank String, @NotNull @Valid DocToscaProperty> properties;
 
     /**
@@ -121,4 +123,20 @@ public class DocToscaWithToscaProperties<T extends ToscaWithToscaProperties> ext
         referencedDataTypes.removeAll(set);
         return referencedDataTypes;
     }
+
+    @Override
+    public int compareTo(final DocToscaEntity<T> otherConcept) {
+        if (this == otherConcept) {
+            return 0;
+        }
+
+        int result = super.compareTo(otherConcept);
+        if (result != 0) {
+            return result;
+        }
+
+        final var other = (DocToscaWithToscaProperties<T>) otherConcept;
+
+        return DocUtil.compareMaps(properties, other.properties);
+    }
 }
index 55b7364..2d62e36 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation.
+ *  Copyright (C) 2022,2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -50,6 +50,7 @@ public class DocToscaWithTypeAndStringProperties<T extends ToscaWithTypeAndObjec
     @SerializedName("type_version")
     private String typeVersion;
 
+    @SuppressWarnings("squid:S1948")
     private Map<String, Object> properties;
 
     /**
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionsTest.java
new file mode 100644 (file)
index 0000000..5262b13
--- /dev/null
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.concepts;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.List;
+import org.junit.jupiter.api.Test;
+
+class AutomationCompositionsTest {
+
+    @Test
+    void testAutomationCompositions() {
+        var ac0 = new AutomationCompositions();
+        ac0.setAutomationCompositionList(List.of(new AutomationComposition()));
+        var ac1 = new AutomationCompositions(ac0);
+        assertEquals(ac0.getAutomationCompositionList(), ac1.getAutomationCompositionList());
+    }
+}
index 2eda9a9..a6b3c0f 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
+ * Copyright (C) 2021-2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -48,6 +48,8 @@ class JpaAutomationCompositionElementTest {
     private static final String ELEMENT_ID = "a95757ba-b34a-4049-a2a8-46773abcbe5e";
     private static final String INSTANCE_ID = "a78757co-b34a-8949-a2a8-46773abcbe2a";
 
+    private static final PfConceptKey CONCEPT_KEY = new PfConceptKey();
+
     @Test
     void testJpaAutomationCompositionElementConstructor() {
         assertThatThrownBy(() -> {
@@ -85,19 +87,19 @@ class JpaAutomationCompositionElementTest {
         }).hasMessageMatching("definition" + NULL_ERROR);
 
         assertThatThrownBy(() -> {
-            new JpaAutomationCompositionElement("key", "key", new PfConceptKey(),
+            new JpaAutomationCompositionElement("key", "key", CONCEPT_KEY,
                 null, LockState.LOCKED);
         }).hasMessageMatching("deployState" + NULL_ERROR);
 
         assertThatThrownBy(() -> {
-            new JpaAutomationCompositionElement("key", "key", new PfConceptKey(),
+            new JpaAutomationCompositionElement("key", "key", CONCEPT_KEY,
                 DeployState.UNDEPLOYED, null);
         }).hasMessageMatching("lockState" + NULL_ERROR);
 
         assertDoesNotThrow(() -> new JpaAutomationCompositionElement());
         assertDoesNotThrow(() -> new JpaAutomationCompositionElement("key", "key"));
         assertDoesNotThrow(() -> new JpaAutomationCompositionElement("key", "key",
-            new PfConceptKey(), DeployState.UNDEPLOYED, LockState.LOCKED));
+                CONCEPT_KEY, DeployState.UNDEPLOYED, LockState.LOCKED));
     }
 
     @Test
@@ -141,7 +143,7 @@ class JpaAutomationCompositionElementTest {
     }
 
     @Test
-    void testJpaAutomationCompositionElementCompareTo() {
+    void testJpaAcElementCompareTo() {
         var testJpaAcElement = createJpaAutomationCompositionElementInstance();
 
         var otherJpaAcElement =
@@ -152,6 +154,16 @@ class JpaAutomationCompositionElementTest {
         assertNotEquals(0,
                 testJpaAcElement.compareTo(new DummyJpaAutomationCompositionElementChild()));
 
+        assertEquals(testJpaAcElement, new JpaAutomationCompositionElement(testJpaAcElement));
+    }
+
+    @Test
+    void testJpaAutomationCompositionElementCompareTo() {
+        var testJpaAcElement = createJpaAutomationCompositionElementInstance();
+
+        var otherJpaAcElement =
+                new JpaAutomationCompositionElement(testJpaAcElement);
+
         testJpaAcElement.setElementId("BadValue");
         assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
         testJpaAcElement.setElementId(ELEMENT_ID);
@@ -205,7 +217,6 @@ class JpaAutomationCompositionElementTest {
         testJpaAcElement.setParticipantId(UUID.randomUUID().toString());
         assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement));
 
-        assertEquals(testJpaAcElement, new JpaAutomationCompositionElement(testJpaAcElement));
     }
 
     @Test
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/StringToMapConverterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/StringToMapConverterTest.java
new file mode 100644 (file)
index 0000000..6724004
--- /dev/null
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.List;
+import java.util.Map;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.models.base.PfModelRuntimeException;
+
+class StringToMapConverterTest {
+
+    @Test
+    void testConvert() {
+        var stringToMapConverter = new StringToMapConverter();
+        Map<String, Object> map =  Map.of("key", List.of("value"));
+        var dbData = stringToMapConverter.convertToDatabaseColumn(map);
+        var result = stringToMapConverter.convertToEntityAttribute(dbData);
+        assertEquals(map, result);
+    }
+
+    @Test
+    void testNull() {
+        var stringToMapConverter = new StringToMapConverter();
+        var dbData = stringToMapConverter.convertToDatabaseColumn(null);
+        assertThat(dbData).isNull();
+        var map = stringToMapConverter.convertToEntityAttribute(null);
+        assertThat(map).isNotNull();
+        assertThatThrownBy(() -> stringToMapConverter.convertToEntityAttribute("1"))
+                .isInstanceOf(PfModelRuntimeException.class);
+    }
+}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/StringToServiceTemplateConverterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/StringToServiceTemplateConverterTest.java
new file mode 100644 (file)
index 0000000..98f22af
--- /dev/null
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.persistence.concepts;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.document.concepts.DocToscaServiceTemplate;
+import org.onap.policy.clamp.models.acm.utils.CommonTestData;
+import org.onap.policy.models.base.PfModelRuntimeException;
+
+class StringToServiceTemplateConverterTest {
+
+    private static final String TOSCA_SERVICE_TEMPLATE_YAML_PROP =
+            "clamp/acm/test/tosca-template-additional-properties.yaml";
+
+    @Test
+    void testConvert() {
+        var inputServiceTemplateProperties = CommonTestData.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML_PROP);
+        var docServiceTemplate = new DocToscaServiceTemplate(inputServiceTemplateProperties);
+        var stringToServiceTemplateConverter = new StringToServiceTemplateConverter();
+        var dbData  = stringToServiceTemplateConverter.convertToDatabaseColumn(docServiceTemplate);
+        var result = stringToServiceTemplateConverter.convertToEntityAttribute(dbData);
+        assertThat(docServiceTemplate.compareTo(result)).isEqualByComparingTo(0);
+    }
+
+    @Test
+    void testNull() {
+        var stringToServiceTemplateConverter = new StringToServiceTemplateConverter();
+        var dbData = stringToServiceTemplateConverter.convertToDatabaseColumn(null);
+        assertThat(dbData).isNull();
+        var docServiceTemplate = stringToServiceTemplateConverter.convertToEntityAttribute(null);
+        assertThat(docServiceTemplate).isNotNull();
+        docServiceTemplate = stringToServiceTemplateConverter.convertToEntityAttribute("");
+        assertThat(docServiceTemplate).isNull();
+        assertThatThrownBy(() -> stringToServiceTemplateConverter.convertToEntityAttribute("1"))
+                .isInstanceOf(PfModelRuntimeException.class);
+    }
+}
index 1b0fe60..39db8c3 100644 (file)
@@ -57,7 +57,12 @@ class MessageHandlerTest {
         var bridge = createMockElementService(ElementType.BRIDGE);
         var messageHandler = createMessageHandler(List.of(starter, bridge));
 
-        assertThatThrownBy(() -> messageHandler.getActiveService())
+        assertThatThrownBy(() -> messageHandler.active(null))
+                .isInstanceOf(NullPointerException.class);
+        assertThatThrownBy(() -> messageHandler.update(null))
+                .isInstanceOf(NullPointerException.class);
+
+        assertThatThrownBy(messageHandler::getActiveService)
                 .isInstanceOf(AutomationCompositionRuntimeException.class);
 
         var elementConfig = new ElementConfig();
diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessagePublisherTest.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessagePublisherTest.java
new file mode 100644 (file)
index 0000000..dafb016
--- /dev/null
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.acm.element.handler;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import java.util.List;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessage;
+import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessageType;
+import org.onap.policy.common.endpoints.event.comm.TopicSink;
+
+
+class MessagePublisherTest {
+
+    @Test
+    void testActiveEmpty() {
+        var messagePublisher = new MessagePublisher();
+        var list = List.<TopicSink>of();
+        assertThatThrownBy(() -> messagePublisher.active(list))
+                .isInstanceOf(IllegalArgumentException.class);
+    }
+
+    @Test
+    void testPublishMsg() {
+        var topic = mock(TopicSink.class);
+        var messagePublisher = new MessagePublisher();
+        messagePublisher.active(List.of(topic));
+        messagePublisher.publishMsg(new ElementMessage(ElementMessageType.STATUS));
+        messagePublisher.stop();
+        verify(topic).send(any());
+    }
+}
index 5ccee7b..453ccc9 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022-2023 Nordix Foundation.
+ *  Copyright (C) 2022-2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -45,6 +45,8 @@ class ActuatorControllerTest extends CommonActuatorController {
     private static final String PROMETHEUS_ENDPOINT = "onap/policy/clamp/acelement/v2/prometheus";
     private static final String SWAGGER_ENDPOINT = "onap/policy/clamp/acelement/v2/v3/api-docs";
 
+    private static final String WRONG_ENDPOINT = "onap/policy/clamp/acelement/v2/wrong";
+
     @LocalServerPort
     private int randomServerPort;
 
@@ -76,28 +78,40 @@ class ActuatorControllerTest extends CommonActuatorController {
     @Test
     void testGetHealth() {
         var invocationBuilder = super.sendActRequest(HEALTH_ENDPOINT);
-        var rawresp = invocationBuilder.buildGet().invoke();
-        assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+        try (var rawresp = invocationBuilder.buildGet().invoke()) {
+            assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+        }
     }
 
     @Test
     void testGetMetrics() {
         var invocationBuilder = super.sendActRequest(METRICS_ENDPOINT);
-        var rawresp = invocationBuilder.buildGet().invoke();
-        assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+        try (var rawresp = invocationBuilder.buildGet().invoke()) {
+            assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+        }
     }
 
     @Test
     void testGetPrometheus() {
         var invocationBuilder = super.sendActRequest(PROMETHEUS_ENDPOINT);
-        var rawresp = invocationBuilder.buildGet().invoke();
-        assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+        try (var rawresp = invocationBuilder.buildGet().invoke()) {
+            assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+        }
     }
 
     @Test
     void testGetSwagger() {
         var invocationBuilder = super.sendActRequest(SWAGGER_ENDPOINT);
-        var rawresp = invocationBuilder.buildGet().invoke();
-        assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+        try (var rawresp = invocationBuilder.buildGet().invoke()) {
+            assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+        }
+    }
+
+    @Test
+    void testWrongEndPoint() {
+        var invocationBuilder = super.sendActRequest(WRONG_ENDPOINT);
+        try (var rawresp = invocationBuilder.buildGet().invoke()) {
+            assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawresp.getStatus());
+        }
     }
 }