diff options
author | 2018-06-18 08:03:05 +0000 | |
---|---|---|
committer | 2018-06-18 08:03:05 +0000 | |
commit | ef8a6b47847012fd59ea20da21d8d3d7c4a301ed (patch) | |
tree | f1a41951fa33f170e674be0c08a6705d9dfa123d /vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java | |
parent | 39a5994da3b9b6c900e16c5c4b015e1aea780adc (diff) | |
parent | 5f147731796cdc11dffde548c3307ea9042640e3 (diff) |
Merge "Getter/setter tests inside the aai model"
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java index bf248a396..7b5b8aa39 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java @@ -1,43 +1,41 @@ package org.onap.vid.aai.model; -import java.util.Map; +import java.io.IOException; +import java.util.ArrayList; +import org.codehaus.jackson.map.ObjectMapper; +import org.junit.Before; import org.junit.Test; -public class AaiGetPnfResponseTest { +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.StringContains.containsString; +import static org.hamcrest.core.IsEqual.equalTo; - private AaiGetPnfResponse createTestSubject() { - return new AaiGetPnfResponse(); - } +public class AaiGetPnfResponseTest { - @Test - public void testGetAdditionalProperties() throws Exception { - AaiGetPnfResponse testSubject; - Map<String, Object> result; + private AaiGetPnfResponse aaiGetPnfResponse; - // default test - testSubject = createTestSubject(); - result = testSubject.getAdditionalProperties(); + @Before + public void setUp(){ + aaiGetPnfResponse = new AaiGetPnfResponse(); + aaiGetPnfResponse.results = new ArrayList<>(); + aaiGetPnfResponse.setAdditionalProperty("key1", "value1"); + aaiGetPnfResponse.setAdditionalProperty("key2", "value2"); } @Test - public void testSetAdditionalProperty() throws Exception { - AaiGetPnfResponse testSubject; - String name = ""; - Object value = null; - - // default test - testSubject = createTestSubject(); - testSubject.setAdditionalProperty(name, value); + public void shouldHaveValidGettersAndSetters() throws IOException { + String result = new ObjectMapper().writeValueAsString(aaiGetPnfResponse); + assertThat(result, containsString("key1")); + assertThat(result, containsString("value2")); + assertThat(result, containsString("key2")); + assertThat(result, containsString("value2")); } @Test - public void testToString() throws Exception { - AaiGetPnfResponse testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); + public void shouldHaveValidToString(){ + assertThat(aaiGetPnfResponse.toString(), + equalTo("AaiGetPnfResponse{results=[], additionalProperties={key1=value1, key2=value2}}")); } + }
\ No newline at end of file |