summaryrefslogtreecommitdiffstats
path: root/prh-commons/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'prh-commons/src/test/java')
-rw-r--r--prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java22
-rw-r--r--prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java32
-rw-r--r--prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/utils/HttpUtilsTest.java13
3 files changed, 31 insertions, 36 deletions
diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java
index 90e42e38..d4c947fd 100644
--- a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java
+++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java
@@ -20,27 +20,24 @@
package org.onap.dcaegen2.services.prh.model;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
import org.apache.http.StatusLine;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import java.io.IOException;
-import java.util.Optional;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
class CommonFunctionsTest {
+
// Given
private ConsumerDmaapModel model = new ConsumerDmaapModelForUnitTest();
- private final static HttpResponse httpResponseMock = mock(HttpResponse.class);
- private final static HttpEntity httpEntityMock = mock(HttpEntity.class);
- private final static StatusLine statusLineMock = mock(StatusLine.class);
+ private static final HttpResponse httpResponseMock = mock(HttpResponse.class);
+ private static final HttpEntity httpEntityMock = mock(HttpEntity.class);
+ private static final StatusLine statusLineMock = mock(StatusLine.class);
@BeforeAll
static void setup() {
@@ -50,7 +47,8 @@ class CommonFunctionsTest {
@Test
void createJsonBody_shouldReturnJsonInString() {
- String expectedResult = "{\"pnf-name\":\"NOKnhfsadhff\",\"ipaddress-v4-oam\":\"256.22.33.155\",\"ipaddress-v6-oam\":\"2001:0db8:85a3:0000:0000:8a2e:0370:7334\"}";
+ String expectedResult = "{\"pnf-name\":\"NOKnhfsadhff\",\"ipaddress-v4-oam\":\"256.22.33.155\""
+ + ",\"ipaddress-v6-oam\":\"2001:0db8:85a3:0000:0000:8a2e:0370:7334\"}";
assertEquals(expectedResult, CommonFunctions.createJsonBody(model));
}
}
diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java
index c54bac11..6b2f9abc 100644
--- a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java
+++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PNF-REGISTRATION-HANDLER
* ================================================================================
@@ -23,28 +23,26 @@ package org.onap.dcaegen2.services.prh.model;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class ConsumerDmaapModelTest {
-
- // Given
- private ConsumerDmaapModel consumerDmaapModel;
- private String pnfName = "NOKnhfsadhff";
- private String ipv4 = "11.22.33.155";
- private String ipv6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
+class ConsumerDmaapModelTest {
@Test
- public void consumerDmaapModelBuilder_shouldBuildAnObject() {
+ void consumerDmaapModelBuilder_shouldBuildAnObject() {
// When
- consumerDmaapModel = ImmutableConsumerDmaapModel.builder()
- .pnfName(pnfName)
- .ipv4(ipv4)
- .ipv6(ipv6)
- .build();
+ // Given
+ String pnfName = "NOKnhfsadhff";
+ String ipv4 = "11.22.33.155";
+ String ipv6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
+ ConsumerDmaapModel consumerDmaapModel = ImmutableConsumerDmaapModel.builder()
+ .pnfName(pnfName)
+ .ipv4(ipv4)
+ .ipv6(ipv6)
+ .build();
// Then
Assertions.assertNotNull(consumerDmaapModel);
- Assertions.assertEquals(pnfName,consumerDmaapModel.getPnfName());
- Assertions.assertEquals(ipv4,consumerDmaapModel.getIpv4());
- Assertions.assertEquals(ipv6,consumerDmaapModel.getIpv6());
+ Assertions.assertEquals(pnfName, consumerDmaapModel.getPnfName());
+ Assertions.assertEquals(ipv4, consumerDmaapModel.getIpv4());
+ Assertions.assertEquals(ipv6, consumerDmaapModel.getIpv6());
}
}
diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/utils/HttpUtilsTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/utils/HttpUtilsTest.java
index d7295071..334bd1bb 100644
--- a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/utils/HttpUtilsTest.java
+++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/utils/HttpUtilsTest.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PNF-REGISTRATION-HANDLER
* ================================================================================
@@ -20,22 +20,21 @@
package org.onap.dcaegen2.services.prh.model.utils;
-import org.apache.http.HttpStatus;
-import org.junit.jupiter.api.Test;
-
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.apache.http.HttpStatus;
+import org.junit.jupiter.api.Test;
-public class HttpUtilsTest {
+class HttpUtilsTest {
@Test
- public void isSuccessfulResponseCode_shouldReturnTrue() {
+ void isSuccessfulResponseCode_shouldReturnTrue() {
assertTrue(HttpUtils.isSuccessfulResponseCode(HttpUtils.SC_ACCEPTED));
}
@Test
- public void isSuccessfulResponseCode_shouldReturnFalse() {
+ void isSuccessfulResponseCode_shouldReturnFalse() {
assertFalse(HttpUtils.isSuccessfulResponseCode(HttpStatus.SC_BAD_GATEWAY));
}
} \ No newline at end of file