aboutsummaryrefslogtreecommitdiffstats
path: root/policy-endpoints
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-08-28 15:22:50 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-28 15:22:50 +0000
commit8ae625423fbf11fa031946caa3f86d552854b893 (patch)
treea5072ec252ce17924ffb7e23fe0cf74faf312c79 /policy-endpoints
parentf133be23c3fab4609e969a89ad64869bc8a7c38f (diff)
parent95751fdf0e69dec1c2850136447679ac344c9230 (diff)
Merge "Adding usage of openpojo in policy common"
Diffstat (limited to 'policy-endpoints')
-rw-r--r--policy-endpoints/pom.xml5
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/report/TestHealthCheckReport.java38
2 files changed, 19 insertions, 24 deletions
diff --git a/policy-endpoints/pom.xml b/policy-endpoints/pom.xml
index fb546a5a..aedb56d8 100644
--- a/policy-endpoints/pom.xml
+++ b/policy-endpoints/pom.xml
@@ -189,6 +189,11 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.openpojo</groupId>
+ <artifactId>openpojo</artifactId>
+ </dependency>
+
</dependencies>
</project>
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/report/TestHealthCheckReport.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/report/TestHealthCheckReport.java
index 72bae0cf..fd4cefb0 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/report/TestHealthCheckReport.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/report/TestHealthCheckReport.java
@@ -20,9 +20,16 @@
package org.onap.policy.common.endpoints.report;
-import static org.junit.Assert.assertEquals;
+import com.openpojo.reflection.filters.FilterClassName;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.rule.impl.SetterMustExistRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
import org.junit.Test;
+import org.onap.policy.common.utils.validation.ToStringTester;
/**
* Class to perform unit test of HealthCheckReport.
@@ -32,28 +39,11 @@ import org.junit.Test;
public class TestHealthCheckReport {
@Test
- public void testReport() {
- final String name = "Policy";
- final String url = "self";
- final boolean healthy = true;
- final int code = 200;
- final String message = "alive";
- final HealthCheckReport report = new HealthCheckReport();
- report.setName(name);
- report.setUrl(url);
- report.setHealthy(healthy);
- report.setCode(code);
- report.setMessage(message);
- validateReport(name, url, healthy, code, message, report);
- }
-
- private void validateReport(final String name, final String url, final boolean healthy, final int code,
- final String message, final HealthCheckReport report) {
- assertEquals(name, report.getName());
- assertEquals(url, report.getUrl());
- assertEquals(healthy, report.isHealthy());
- assertEquals(code, report.getCode());
- assertEquals(message, report.getMessage());
- assertEquals("Report [name=Policy, url=self, healthy=true, code=200, message=alive]", report.toString());
+ public void testHealthCheckReport() {
+ final Validator validator =
+ ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule())
+ .with(new GetterTester()).with(new SetterTester()).with(new ToStringTester()).build();
+ validator.validate(HealthCheckReport.class.getPackage().getName(),
+ new FilterClassName(HealthCheckReport.class.getName()));
}
}