aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2024-07-03 09:33:55 +0100
committerwaynedunican <wayne.dunican@est.tech>2024-07-03 10:38:16 +0100
commit0f0be68b0369ac3829663cc60bfe8b31fa38807d (patch)
treebaf3aa37cb38c5e069de5a61c471e527491a5849 /main
parent8fb19179f944eab3f63a737e761443d6951c958e (diff)
Fix test failures
Fix test failures after removal of ToStringTester in models Issue-ID: POLICY-5042 Change-Id: I7373cd8f6c2e36685cfdb781734c4b7621174c72 Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'main')
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/TestStatisticsReport.java53
1 files changed, 39 insertions, 14 deletions
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestStatisticsReport.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestStatisticsReport.java
index 550248b9..f774e022 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestStatisticsReport.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestStatisticsReport.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,15 +21,11 @@
package org.onap.policy.pdpx.main.rest;
-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.test.ToStringTester;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.pdpx.main.rest.model.StatisticsReport;
/**
@@ -37,11 +34,39 @@ import org.onap.policy.pdpx.main.rest.model.StatisticsReport;
*/
public class TestStatisticsReport {
+ static StatisticsReport report;
+
+ @BeforeAll
+ static void setUp() {
+ report = new StatisticsReport();
+ }
+
@Test
- public void testStatisticsReport() {
- final Validator validator = ValidatorBuilder.create().with(new ToStringTester()).with(new SetterMustExistRule())
- .with(new GetterMustExistRule()).with(new SetterTester()).with(new GetterTester()).build();
- validator.validate(StatisticsReport.class.getPackage().getName(),
- new FilterClassName(StatisticsReport.class.getName()));
+ void testStatisticsReportConstructor() {
+ assertNotNull(report);
+ }
+
+ @Test
+ void testGettersAndSetters() {
+ report.setCode(123);
+ report.setApplicationMetrics(null);
+ report.setDenyDecisionsCount(123456);
+ report.setDeployFailureCount(1111);
+ report.setDeploySuccessCount(2222);
+ report.setPermitDecisionsCount(3333);
+ report.setIndeterminantDecisionsCount(4444);
+ report.setNotApplicableDecisionsCount(5555);
+ report.setTotalErrorCount(6666);
+ report.setTotalPoliciesCount(7777);
+ report.setUndeployFailureCount(8888);
+ report.setUndeploySuccessCount(9999);
+ report.setTotalPolicyTypesCount(9898);
+
+ assertThat(report.toString()).contains("code=123", "totalPolicyTypesCount=9898",
+ "totalPoliciesCount=7777", "totalErrorCount=6666", "permitDecisionsCount=3333",
+ "denyDecisionsCount=123456", "deploySuccessCount=2222", "deployFailureCount=1111",
+ "undeploySuccessCount=9999", "undeployFailureCount=8888",
+ "indeterminantDecisionsCount=4444", "notApplicableDecisionsCount=5555",
+ "applicationMetrics=null");
}
}