summaryrefslogtreecommitdiffstats
path: root/prh-commons/src
diff options
context:
space:
mode:
Diffstat (limited to 'prh-commons/src')
-rw-r--r--prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java1
-rw-r--r--prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java2
-rw-r--r--prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/utils/HttpUtils.java3
-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
6 files changed, 35 insertions, 38 deletions
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java
index 7dba211f..4c99ba3a 100644
--- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java
+++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.model;
import com.google.gson.annotations.SerializedName;
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java
index 7b48bd80..76f51749 100644
--- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java
+++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PNF-REGISTRATION-HANDLER
* ================================================================================
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/utils/HttpUtils.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/utils/HttpUtils.java
index b280949e..11fca099 100644
--- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/utils/HttpUtils.java
+++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/utils/HttpUtils.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PNF-REGISTRATION-HANDLER
* ================================================================================
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.model.utils;
import org.apache.http.HttpStatus;
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