diff options
author | grabinsk <maciej.grabinski@nokia.com> | 2019-05-23 14:25:24 +0200 |
---|---|---|
committer | grabinsk <maciej.grabinski@nokia.com> | 2019-05-23 14:25:24 +0200 |
commit | 14433b1454dd4b881b8b36f184d63528a43931ba (patch) | |
tree | 1b37d5de5dee6d701f43165ca4e35232c47a0129 /prh-commons/src/test/java/org | |
parent | e2f12ecdee8f9320e23b95a1671cb7c8fcacf361 (diff) |
Fix sending PNF_READY notification after update to El Alto SDK version usage
Change-Id: I06c1ae2b2a9831a4c31e09fafbe1500c10714caa
Issue-ID: DCAEGEN2-1501
Signed-off-by: grabinsk <maciej.grabinski@nokia.com>
Diffstat (limited to 'prh-commons/src/test/java/org')
-rw-r--r-- | prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilderTest.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilderTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilderTest.java index e104f54e..769e1673 100644 --- a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilderTest.java +++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/PnfReadyJsonBodyBuilderTest.java @@ -31,23 +31,23 @@ class PnfReadyJsonBodyBuilderTest { @Test void createJsonBody_shouldReturnJsonInString() { - JsonObject jsonObject = new JsonParser().parse("{\n" + JsonObject jsonObject = parse("{\n" + " \"attachmentPoint\": \"bla-bla-30-3\",\n" + " \"cvlan\": \"678\",\n" + " \"svlan\": \"1005\"\n" - + " }").getAsJsonObject(); + + " }"); ConsumerDmaapModel model = ImmutableConsumerDmaapModel.builder() .correlationId("NOKnhfsadhff") .additionalFields(jsonObject) .build(); - String expectedResult = "{" + JsonObject expectedResult = parse("{" + "\"correlationId\":\"NOKnhfsadhff\"," + "\"additionalFields\":{\"attachmentPoint\":\"bla-bla-30-3\",\"cvlan\":\"678\",\"svlan\":\"1005\"}" - + "}"; + + "}"); - assertEquals(expectedResult, new PnfReadyJsonBodyBuilderImpl().createJsonBody(model)); + assertEquals(expectedResult, new PnfReadyJsonBodyBuilder().createJsonBody(model)); } @Test @@ -57,22 +57,26 @@ class PnfReadyJsonBodyBuilderTest { .correlationId("NOKnhfsadhff") .build(); - String expectedResult = "{\"correlationId\":\"NOKnhfsadhff\"}"; + JsonObject expectedResult = parse("{\"correlationId\":\"NOKnhfsadhff\"}"); - assertEquals(expectedResult, new PnfReadyJsonBodyBuilderImpl().createJsonBody(model)); + assertEquals(expectedResult, new PnfReadyJsonBodyBuilder().createJsonBody(model)); } @Test void createJsonBodyWithEmptyOptionalPnfRegistrationFields_shouldReturnJsonInString() { - JsonObject jsonObject = new JsonParser().parse("{}").getAsJsonObject(); + JsonObject jsonObject = new JsonObject(); ConsumerDmaapModel model = ImmutableConsumerDmaapModel.builder() .correlationId("NOKnhfsadhff") .additionalFields(jsonObject) .build(); - String expectedResult = "{\"correlationId\":\"NOKnhfsadhff\"}"; + JsonObject expectedResult = parse("{\"correlationId\":\"NOKnhfsadhff\"}"); - assertEquals(expectedResult, new PnfReadyJsonBodyBuilderImpl().createJsonBody(model)); + assertEquals(expectedResult, new PnfReadyJsonBodyBuilder().createJsonBody(model)); + } + + private static JsonObject parse(String jsonString) { + return new JsonParser().parse(jsonString).getAsJsonObject(); } } |