diff options
Diffstat (limited to 'so-cnf-adapter-application/src/test')
2 files changed, 11 insertions, 18 deletions
diff --git a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java index 979f13b..c85031a 100644 --- a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java +++ b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java @@ -28,10 +28,12 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.onap.so.adapters.cnf.MulticloudConfiguration; import org.onap.so.adapters.cnf.model.*; +import org.onap.so.adapters.cnf.model.healthcheck.HealthCheckResponse; import org.onap.so.adapters.cnf.service.CnfAdapterService; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.context.request.async.DeferredResult; import org.springframework.web.multipart.MultipartFile; import java.util.ArrayList; import java.util.HashMap; @@ -61,13 +63,16 @@ public class CnfAdapterRestTest { @Test public void healthCheckTest() throws Exception { - - ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK); + HealthCheckResponse response = new HealthCheckResponse(); + DeferredResult<HealthCheckResponse> deferredResponse = new DeferredResult<>(); + deferredResponse.setResult(response); CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class); - Mockito.when(cnfAdapterService.healthCheck()).thenReturn(String.valueOf(response)); - cnfAdapterRest.healthCheck(); + CheckInstanceRequest healthCheckRequest = Mockito.mock(CheckInstanceRequest.class); + Mockito.when(cnfAdapterService.healthCheck(healthCheckRequest)).thenReturn(response); + + cnfAdapterRest.healthCheck(healthCheckRequest); + Assert.assertNotNull(response); - assertEquals(HttpStatus.OK, response.getStatusCode()); } @Test @@ -573,6 +578,3 @@ public class CnfAdapterRestTest { } } } - - - diff --git a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java index bdad347..8e8cd5c 100644 --- a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java +++ b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java @@ -48,16 +48,7 @@ public class CnfAdapterServiceTest { @Mock ResponseEntity<String> instanceResponse; - @Test - public void healthCheckTest() throws Exception { - try { - cnfAdapterService.healthCheck(); - } - catch (Exception exp) { - assert(true); - } - - } + @Test public void createInstanceTest() throws Exception { Map<String, String> labels = new HashMap<String, String>(); |