Removed deprecated Matcher imports
[so.git] / common / src / test / java / org / onap / so / client / aai / entities / uri / ServiceInstanceUriTest.java
index 2cd7848..6059e7b 100644 (file)
@@ -29,7 +29,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
@@ -48,7 +48,7 @@ import javax.ws.rs.core.UriBuilder;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
 import org.onap.so.client.aai.AAIResourcesClient;
 import org.onap.so.client.aai.entities.AAIResultWrapper;
 import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
@@ -84,7 +84,7 @@ public class ServiceInstanceUriTest {
                 
                ServiceInstanceUri instance = new ServiceInstanceUri("key1");
                ServiceInstanceUri spy = spy(instance);
-               doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getSerivceInstance(any(Object.class));
+               doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getObjectById(any(Object.class));
                
                final URI result = spy.build();
                final URI expected = UriBuilder.fromPath("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").build();
@@ -97,7 +97,7 @@ public class ServiceInstanceUriTest {
                 
                ServiceInstanceUri instance = new ServiceInstanceUri("key1");
                ServiceInstanceUri spy = spy(instance);
-               doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getSerivceInstance(any(Object.class));
+               doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getObjectById(any(Object.class));
                
                final URI result = spy.resourceVersion("1234").build();
                final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234").build();
@@ -110,7 +110,7 @@ public class ServiceInstanceUriTest {
                 
                ServiceInstanceUri instance = new ServiceInstanceUri("key1");
                ServiceInstanceUri spy = spy(instance);
-               doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space").when(spy).getSerivceInstance(any(Object.class));
+               doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space").when(spy).getObjectById(any(Object.class));
                
                final URI result = spy.build();
                final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space").build();
@@ -123,7 +123,7 @@ public class ServiceInstanceUriTest {
                 
                ServiceInstanceUri instance = new ServiceInstanceUri("key1");
                ServiceInstanceUri spy = spy(instance);
-               doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%28space").when(spy).getSerivceInstance(any(Object.class));
+               doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%28space").when(spy).getObjectById(any(Object.class));
                
                assertThat(spy.getURIKeys().values(), contains("key1", "key2", "key3(space"));
                
@@ -133,7 +133,7 @@ public class ServiceInstanceUriTest {
                ServiceInstanceUri instance = new ServiceInstanceUri("key1");
                ServiceInstanceUri spy = spy(instance);
                String uri = "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
-               doReturn(uri).when(spy).getSerivceInstance(any(Object.class));
+               doReturn(uri).when(spy).getObjectById(any(Object.class));
                doReturn(Optional.of(uri)).when(spy).getCachedValue();
                final URI result = spy.resourceVersion("1234").clone().build();
                final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234").build();
@@ -158,7 +158,7 @@ public class ServiceInstanceUriTest {
                ServiceInstanceUri spy = spy(instance);
                AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class);
                AAIResultWrapper wrapper = mock(AAIResultWrapper.class);
-               when(mockResourcesClient.get(Matchers.<AAIResourceUri>any(AAIResourceUri.class), Matchers.<Class<NotFoundException>>any())).thenReturn(wrapper);
+               when(mockResourcesClient.get(ArgumentMatchers.<AAIResourceUri>any(AAIResourceUri.class), ArgumentMatchers.<Class<NotFoundException>>any())).thenReturn(wrapper);
                when(wrapper.getJson()).thenReturn(content);
                when(spy.getResourcesClient()).thenReturn(mockResourcesClient);
                exception.expect(GraphInventoryUriComputationException.class);
@@ -181,10 +181,6 @@ public class ServiceInstanceUriTest {
                ServiceInstanceUri spy = spy(instance);
                AAIResourcesClient client = createClient();
                doReturn(client).when(spy).getResourcesClient();
-               /*AAIResultWrapper wrapper = mock(AAIResultWrapper.class);
-               when(client.get(Matchers.<AAIResourceUri>any(AAIResourceUri.class), Matchers.<Class<NotFoundException>>any())).thenReturn(wrapper);
-               when(wrapper.getJson()).thenReturn("{\"results\":[]}");
-               doReturn(client).when(spy).getResourcesClient();*/
                stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3")) 
                                .willReturn(aResponse() 
                                        .withStatus(404)