### Question:
ServiceInstanceUri extends HttpLookupUri { public AAIResourcesClient getResourcesClient() { return new AAIResourcesClient(); } protected  ServiceInstanceUri(AAIObjectType type, UriBuilder builder, Optional<String> cachedValue,
            Object... values); protected  ServiceInstanceUri(AAISingleFragment fragment); @Override ServiceInstanceUri clone(); AAIResourcesClient getResourcesClient(); @Override URI buildNoNetwork();  }### Answer:
@Test public void notfound() throws IOException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "empty-query-result.json"))); ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key3")); ServiceInstanceUri spy = spy(instance); AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class); AAIResultWrapper wrapper = mock(AAIResultWrapper.class); 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); spy.locateAndBuild(); }
@Test public void noVertexFound() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key3")); ServiceInstanceUri spy = spy(instance); AAIResourcesClient client = aaiClient; doReturn(client).when(spy).getResourcesClient(); wireMockRule .stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3")).willReturn( aResponse().withStatus(404).withHeader("Content-Type", "application/json").withBodyFile(""))); exception.expect(NotFoundException.class); spy.locateAndBuild(); }