added test case to AaiServiceImplTest 93/72893/2
authorSandeep J <sandeejh@in.ibm.com>
Fri, 16 Nov 2018 09:18:51 +0000 (14:48 +0530)
committerSandeep Jha <sandeejh@in.ibm.com>
Fri, 16 Nov 2018 09:23:32 +0000 (09:23 +0000)
to increase code coverage

Issue-ID: CCSDK-552
Change-Id: Ib89f25c39bf0878170da6997ca74c587c4c72535
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImpl.java
ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java

index 6c4ae88..7356c3b 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
  * 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
@@ -125,4 +127,8 @@ public class AaiServiceImpl {
         }
         return this.restTemplate;
     }
+
+    public void setAaiProps(AaiProps aaiProps) {
+        this.aaiProps = aaiProps;
+    }
 }
index b25de21..8507bf6 100644 (file)
@@ -4,8 +4,6 @@
  * ================================================================================
  * Copyright (C) 2018 IBM.
  * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * ================================================================================
  * 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
@@ -26,7 +24,9 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.ccsdk.apps.ms.neng.core.resource.model.AaiResponse;
+import org.onap.ccsdk.apps.ms.neng.extinf.props.AaiProps;
 import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.web.client.RestTemplate;
 
 public class AaiServiceImplTest {
     private AaiServiceImpl aaiServiceImpl;
@@ -48,4 +48,14 @@ public class AaiServiceImplTest {
         AaiResponse aaiResponse = aaiServiceImpl.buildResponse(true);
         Assert.assertEquals(aaiResponse.isRecFound(), true);
     }
+    
+    @Test(expected= Exception.class)
+    public void testValidate() throws Exception {
+        AaiProps aaiProps=new AaiProps();
+        aaiProps.setUriBase("http://");
+        aaiServiceImpl.setAaiProps(aaiProps);
+        aaiServiceImpl.setRestTemplate(new RestTemplate());
+        aaiServiceImpl.validate("testUrl/","testName");
+        
+    }
 }