aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2018-10-04 13:20:47 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-04 13:20:47 +0000
commitf2dd84106d8216af291ebb47606d18e433ffb832 (patch)
tree5581a37eda050ccc8db6c86907803cded3989b12
parentb09e94e4c7154a61b6f5e4918635b9aface68a5f (diff)
parent0eb74a3aca9e996ba6954dc102e25120d693067b (diff)
Merge "Added testcase to PolicyFinderServiceImpl"
-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();