Remove Sonar issues
[nonrtric.git] / policy-agent / src / test / java / org / oransc / policyagent / ApplicationTest.java
index 7618306..0fb80f3 100644 (file)
@@ -81,6 +81,7 @@ import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit.jupiter.SpringExtension;
 import org.springframework.web.reactive.function.client.WebClientResponseException;
 
@@ -90,6 +91,10 @@ import reactor.util.annotation.Nullable;
 
 @ExtendWith(SpringExtension.class)
 @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@TestPropertySource(
+    properties = { //
+        "server.ssl.key-store=./config/keystore.jks", //
+        "app.webclient.trust-store=./config/truststore.jks"})
 class ApplicationTest {
     private static final Logger logger = LoggerFactory.getLogger(ApplicationTest.class);
 
@@ -332,7 +337,7 @@ class ApplicationTest {
 
         url = "/policies";
         String rsp = restClient().get(url).block();
-        assertThat(rsp).contains(policyInstanceId).as("Response contains policy instance ID.");
+        assertThat(rsp).as("Response contains policy instance ID.").contains(policyInstanceId);
 
         url = "/policy?id=" + policyInstanceId;
         rsp = restClient().get(url).block();
@@ -343,6 +348,7 @@ class ApplicationTest {
         testErrorCode(restClient().put(url, policyBody), HttpStatus.NOT_FOUND);
 
         url = putPolicyUrl(serviceName, ricName, policyTypeName + "XX", policyInstanceId);
+        addPolicyType(policyTypeName + "XX", "otherRic");
         testErrorCode(restClient().put(url, policyBody), HttpStatus.NOT_FOUND);
 
         url = putPolicyUrl(serviceName, ricName, policyTypeName, policyInstanceId);
@@ -597,7 +603,7 @@ class ApplicationTest {
         // GET (all)
         url = "/services";
         rsp = restClient().get(url).block();
-        assertThat(rsp).contains(serviceName).as("Response contains service name");
+        assertThat(rsp).as("Response contains service name").contains(serviceName);
         logger.info(rsp);
 
         // Keep alive