diff options
author | Benjamin, Max <max.benjamin@att.com> | 2020-07-27 12:08:37 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-07-27 12:08:37 -0400 |
commit | 06f0c5d6cc9ce850d8eb1dbda0d18ae6cfe05133 (patch) | |
tree | 47aa554dccbc279f0283023fba5666bc9a199396 /graph-inventory/aai-client/src/test/java | |
parent | 852b16f2d60356becf222d2360ac85c977601b8c (diff) |
add lambda function to modify uris
add lambda function to modify uris
formatted files after modifications
Issue-ID: SO-3101
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Ia91adbf929e157a8ba3add8a4683e12ba3a64489
Diffstat (limited to 'graph-inventory/aai-client/src/test/java')
-rw-r--r-- | graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java index 10162f83ee..9e106fab85 100644 --- a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java @@ -21,12 +21,15 @@ package org.onap.aaiclient.client.aai.entities; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; import org.onap.aaiclient.client.aai.AAIObjectType; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; @@ -53,4 +56,27 @@ public class RelationshipsTest { } + @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(AAIObjectType.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(AAIObjectType.VCE); + + assertTrue(argument.getAllValues().stream().allMatch(item -> !item.build().toString().contains("?"))); + + } } |