import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.ccsdk.apps.ms.neng.core.exceptions.NengException;
Map<String, Object> configMap = buildPolicyResponse();
Object resp = Arrays.asList(new Object[] {configMap});
ResponseEntity<Object> respEn = new ResponseEntity<>(resp, HttpStatus.OK);
- when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenReturn(respEn);
+ Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenReturn(respEn);
policManProps.setUrl("http://policyManager.onap.org");
Map<String, Object> configMap = buildPolicyResponse();
Object resp = Arrays.asList(new Object[] {configMap});
ResponseEntity<Object> respEn = new ResponseEntity<>(resp, HttpStatus.INTERNAL_SERVER_ERROR);
- when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenReturn(respEn);
+ Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenReturn(respEn);
policManProps.setUrl("http://policyManager.onap.org");
@Test(expected = NengException.class)
public void testmakeOutboundCall_500_statusExp() throws Exception {
HttpClientErrorException exp = new HttpClientErrorException(HttpStatus.METHOD_NOT_ALLOWED, "{error}");
- when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenThrow(exp);
+ Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenThrow(exp);
policManProps.setUrl("http://policyManager.onap.org");
GetConfigRequest request = new GetConfigRequest();
request.setPolicyName("policy");
@Test(expected = NengException.class)
public void testmakeOutboundCall_500_statusExp_notFound() throws Exception {
HttpClientErrorException exp = new HttpClientErrorException(HttpStatus.NOT_FOUND, "{error}");
- when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenThrow(exp);
+ Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenThrow(exp);
policManProps.setUrl("http://policyManager.onap.org");
GetConfigRequest request = new GetConfigRequest();
request.setPolicyName("policy");