import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.ccsdk.apps.ms.neng.core.exceptions.NengException;
import org.onap.ccsdk.apps.ms.neng.core.resource.model.GetConfigRequest;
import org.onap.ccsdk.apps.ms.neng.core.resource.model.GetConfigResponse;
@Test
public void testConfig() throws Exception {
doReturn(new GetConfigResponse()).when(policyFinder).makeOutboundCall(
- Matchers.any(), Matchers.any(), Matchers.any());
+ ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.any());
assertNotNull(policyFinder.getConfig("policy"));
}
@Test
public void testFindPolicy() throws Exception {
doReturn(new GetConfigResponse()).when(policyFinder).makeOutboundCall(
- Matchers.any(), Matchers.any(), Matchers.any());
+ ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.any());
assertNull(policyFinder.findPolicy("policy"));
}
Map<String, Object> configMap = buildPolicyResponse();
Object resp = Arrays.asList(new Object[] {configMap});
ResponseEntity<Object> respEn = new ResponseEntity<>(resp, HttpStatus.OK);
- Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenReturn(respEn);
+ Mockito.lenient().when(restTemplate.exchange(ArgumentMatchers.any(RequestEntity.class), ArgumentMatchers.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);
- Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenReturn(respEn);
+ Mockito.lenient().when(restTemplate.exchange(ArgumentMatchers.any(RequestEntity.class), ArgumentMatchers.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}");
- Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenThrow(exp);
+ Mockito.lenient().when(restTemplate.exchange(ArgumentMatchers.any(RequestEntity.class), ArgumentMatchers.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}");
- Mockito.lenient().when(restTemplate.exchange(Matchers.any(RequestEntity.class), Matchers.any(Class.class))).thenThrow(exp);
+ Mockito.lenient().when(restTemplate.exchange(ArgumentMatchers.any(RequestEntity.class), ArgumentMatchers.any(Class.class))).thenThrow(exp);
policManProps.setUrl("http://policyManager.onap.org");
GetConfigRequest request = new GetConfigRequest();
request.setPolicyName("policy");