Improve coverage and silence sonar warnings
[portal/ric-dashboard.git] / webapp-backend / src / test / java / org / oransc / ric / portal / dashboard / k8sapi / CaasIngressTest.java
index f882c14..f28494d 100644 (file)
@@ -21,11 +21,11 @@ package org.oransc.ric.portal.dashboard.k8sapi;
 
 import java.lang.invoke.MethodHandles;
 
+import org.junit.Assert;
 import org.junit.jupiter.api.Test;
 import org.oransc.ric.portal.dashboard.util.HttpsURLConnectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.http.ResponseEntity;
 import org.springframework.web.client.RestTemplate;
 
 public class CaasIngressTest {
@@ -33,15 +33,16 @@ public class CaasIngressTest {
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
        @Test
-       public void test() throws Exception {
+       public void coverHttpsUtils() throws Exception {
                HttpsURLConnectionUtils.turnOffSslChecking();
                // Get IP address from REC deployment team for testing
                final String podsUrl = "https://localhost:16443/api/v1/namespaces/ricaux/pods";
                RestTemplate rt = new RestTemplate();
                try {
-                       ResponseEntity<String> podsResponse = rt.getForEntity(podsUrl, String.class);
-                       logger.info(podsResponse.getBody());
+                       rt.getForEntity(podsUrl, String.class);
+                       Assert.assertTrue(false);
                } catch (Exception ex) {
+                       Assert.assertNotNull(ex);
                        logger.warn("Failed as expected");
                }
                HttpsURLConnectionUtils.turnOnSslChecking();