aboutsummaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
authorezhil <ezhrajam@in.ibm.com>2018-09-27 16:10:01 +0530
committerezhil <ezhrajam@in.ibm.com>2018-09-27 16:11:27 +0530
commit0eb74a3aca9e996ba6954dc102e25120d693067b (patch)
treeceaafd48be4e720d21b1a4b22ac6f591c7752c11 /ms
parent39df671e006ec2a16fb3d5360af2ba60a6f6ae17 (diff)
Added testcase to PolicyFinderServiceImpl
Added testcase for handle error method in PolicyFinderService Issue-ID: CCSDK-594 Change-Id: I5ec263001af0cf7ddc5a8065e54d5d162c295e29 Signed-off-by: ezhil <ezhrajam@in.ibm.com>
Diffstat (limited to 'ms')
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java27
1 files changed, 17 insertions, 10 deletions
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java
index 4dc4fa7c..77ec7eeb 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java
@@ -22,17 +22,7 @@
package org.onap.ccsdk.apps.ms.neng.service.extinf.impl;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
-
import com.fasterxml.jackson.databind.ObjectMapper;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@@ -49,8 +39,18 @@ import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+
@RunWith(MockitoJUnitRunner.class)
public class PolicyFinderServiceImplTest {
@InjectMocks
@@ -78,6 +78,13 @@ public class PolicyFinderServiceImplTest {
}
@SuppressWarnings("unchecked")
+ @Test(expected = NengException.class)
+ public void testHandleError_NOT_FOUND() throws Exception{
+ HttpStatusCodeException e = new HttpClientErrorException(HttpStatus.NOT_FOUND,"",null,StandardCharsets.US_ASCII);
+ policyFinder.handleError(e);
+
+ }
+ @SuppressWarnings("unchecked")
@Test
public void testmakeOutboundCall() throws Exception {
Map<String, Object> configMap = buildPolicyResponse();