diff options
Diffstat (limited to 'server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java')
-rw-r--r-- | server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java index 0304e42d..a8e2dd45 100644 --- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceServiceTest.java @@ -72,4 +72,30 @@ public class DefaultServiceInstanceServiceTest { Assert.assertTrue("service instances should be empty.", serviceInstances.isEmpty()); } + + @Test(expected = AAIException.class) + public void getRelationShipDataWillThrowExceptionWhenAAIIsNotAvailable() { + AAIService aaiService = mock(AAIService.class); + String customerId = "1"; + String serviceType = "service"; + String result="result"; + when(aaiService.getAAIServiceInstance(customerId, serviceType,result)).thenReturn(failedCall("AAI is not available!")); + + ServiceInstanceService service = new DefaultServiceInstanceService(aaiService); + service.getRelationShipData(customerId, serviceType,result); + } + + @Test + public void getRelationShipDataWillThrowExceptionWhenNoServiceInstancesInAAI() { + AAIService aaiService = mock(AAIService.class); + String customerId = "1"; + String serviceType = "service"; + String result="result"; + when(aaiService.getAAIServiceInstance(customerId, serviceType,result)).thenReturn(emptyBodyCall()); + + ServiceInstanceService service = new DefaultServiceInstanceService(aaiService); + String aa = service.getRelationShipData(customerId, serviceType,result); + + Assert.assertTrue("service instances should be empty.", aa.isEmpty()); + } }
\ No newline at end of file |