### Question:
Relationships extends GraphInventoryRelationships<AAIResultWrapper, AAIResourceUri, AAIObjectType> { protected AAIResultWrapper get(AAIResourceUri uri) { return new AAIResourcesClient().get(uri); } Relationships(String json); @Deprecated /** * Use getRelatedUris instead * * @return */ List<AAIResourceUri> getRelatedAAIUris(); @Deprecated /** * Use getRelatedUris instead * * @return */ List<AAIResourceUri> getRelatedAAIUris(GraphInventoryObjectName type);  }### Answer:
@Test public void run() throws IOException { final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "e2e-complex.json"))); AAIResultWrapper wrapper = new AAIResultWrapper(content); Relationships relationships = wrapper.getRelationships().get(); List<AAIResourceUri> test = relationships.getRelatedUris(Types.VCE); List<AAIResourceUri> uris = Arrays.asList( AAIUriFactory .createResourceUri(AAIFluentTypeBuilder.network().vce("a9fec18e-1ea3-40e4-a6c0-a89b3de07053")), AAIUriFactory .createResourceUri(AAIFluentTypeBuilder.network().vce("8ae1e5f8-61f1-4c71-913a-b40cc4593cb9")), AAIUriFactory .createResourceUri(AAIFluentTypeBuilder.network().vce("a2935fa9-b743-49f4-9813-a127f13c4e93")), AAIUriFactory .createResourceUri(AAIFluentTypeBuilder.network().vce("c7fe7698-8063-4e26-8bd3-ca3edde0b0d4"))); assertTrue(uris.containsAll(test) && test.containsAll(uris)); }
@Test public void getByTypeTest() throws IOException { final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "e2e-complex.json"))); AAIResultWrapper wrapper = new AAIResultWrapper(content); Relationships relationships = wrapper.getRelationships().get(); Relationships spy = Mockito.spy(relationships); ArgumentCaptor<AAIResourceUri> argument = ArgumentCaptor.forClass(AAIResourceUri.class); doReturn(new AAIResultWrapper("{}")).when(spy).get(argument.capture()); spy.getByType(Types.VCE, uri -> uri.nodesOnly(true)); assertTrue(argument.getAllValues().stream().allMatch(item -> item.build().toString().contains("nodes-only"))); argument = ArgumentCaptor.forClass(AAIResourceUri.class); doReturn(new AAIResultWrapper("{}")).when(spy).get(argument.capture()); spy.getByType(Types.VCE); assertTrue(argument.getAllValues().stream().allMatch(item -> !item.build().toString().contains("?"))); }