diff options
author | 2020-07-17 14:08:52 +0100 | |
---|---|---|
committer | 2020-07-21 15:35:05 +0100 | |
commit | 53b9324d6ec14ef75dc1f943c19b3ea1a46bc8ab (patch) | |
tree | a0fa4cd006a10b4a2ea8a57194bf44d75f51d973 /testsuites/integration/integration-executor-test/src/test/java/org/onap | |
parent | cb4b9a2e27266c03fa6aa82165608999bf21e36a (diff) |
Fix assertTrue in apex-pdp/model apex-pdp/plugins, apex-pdp/services and apex-pdp/testsuites
Replace assertTrue with assertEquals and assertFalse with
assertNotEquals in apex-pdp/model, apex-pdp/plugins, apex-pdp/services
and apex-pdp/testsuites
Issue-ID: POLICY-2690
Change-Id: If088371cf012d5648e04ade2aa4d49b38945f6d2
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Diffstat (limited to 'testsuites/integration/integration-executor-test/src/test/java/org/onap')
4 files changed, 20 insertions, 21 deletions
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java index bf883d761..ba4b225d2 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java @@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.Date; @@ -194,11 +193,11 @@ public class TestEventInstantiation { final double temp2 = (double) event.get("TestTemperature"); assertNotNull(temp2); - assertTrue(temp2 == 123.456789); + assertEquals(123.456789, temp2, 0); final Double temp3 = (Double) event.get("TestTemperature"); assertNotNull(temp3); - assertTrue(temp3 == 123.456789); + assertEquals(123.456789, temp3, 0); final Date aDate = new Date(1433453067123L); final Map<String, Object> eventDataList = new HashMap<String, Object>(); @@ -223,7 +222,7 @@ public class TestEventInstantiation { final double temp4 = (double) event.get("TestTemperature"); assertNotNull(temp4); - assertTrue(temp4 == 34.5445667); + assertEquals(34.5445667, temp4, 0); logger.debug(event.toString()); } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java index aaf640bb4..dc5c06f85 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java @@ -21,9 +21,9 @@ package org.onap.policy.apex.testsuites.integration.executor.handling; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; @@ -89,13 +89,13 @@ public class TestApexModelExport { model.getKeyInformation().getKeyInfoMap().remove(new AxArtifactKey("TestContextItem00B", "0.0.1")); model.getKeyInformation().getKeyInfoMap().remove(new AxArtifactKey("TestContextItem00C", "0.0.1")); - assertTrue(model.equals(exportedModel0)); + assertEquals(model, exportedModel0); exportPolicyList.remove(0); final AxPolicyModel exportedModel1 = PolicyModelSplitter.getSubPolicyModel(model, exportPolicyList); - assertFalse(model.equals(exportedModel1)); - assertTrue(model.getPolicies().get("Policy1").equals(exportedModel1.getPolicies().get("Policy1"))); + assertNotEquals(model, exportedModel1); + assertEquals(model.getPolicies().get("Policy1"), exportedModel1.getPolicies().get("Policy1")); exportPolicyList.clear(); exportPolicyList.add(new AxArtifactKey("NonExistentPolicy", "0.0.1")); diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java index 3f38a10dd..0561162c8 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 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,7 +21,7 @@ package org.onap.policy.apex.testsuites.integration.executor.handling; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; import java.sql.Connection; import java.sql.DriverManager; @@ -58,7 +59,7 @@ public class TestApexSamplePolicyModel { @Test public void testModelValid() throws Exception { final AxValidationResult result = testApexModel.testApexModelValid(); - assertTrue(result.toString().equals(VALID_MODEL_STRING)); + assertEquals(VALID_MODEL_STRING, result.toString()); } /** diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java index d2e35ecb2..0a4b9a7d5 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ package org.onap.policy.apex.testsuites.integration.executor.handling; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.io.IOException; import org.junit.After; @@ -67,12 +66,12 @@ public class TestContextUpdateDifferentModels { @Before public void beforeTest() { schemaParameters = new SchemaParameters(); - + schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); ParameterService.register(schemaParameters); - + contextParameters = new ContextParameters(); contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME); @@ -84,7 +83,7 @@ public class TestContextUpdateDifferentModels { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + engineParameters = new EngineParameters(); engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); ParameterService.register(engineParameters); @@ -96,7 +95,7 @@ public class TestContextUpdateDifferentModels { @After public void afterTest() { ParameterService.deregister(engineParameters); - + ParameterService.deregister(contextParameters.getDistributorParameters()); ParameterService.deregister(contextParameters.getLockManagerParameters()); ParameterService.deregister(contextParameters.getPersistorParameters()); @@ -136,16 +135,16 @@ public class TestContextUpdateDifferentModels { assertEquals(apexEngine.getInternalContext().getContextAlbums().size(), apexModelSample.getAlbums().getAlbumsMap().size()); for (final ContextAlbum contextAlbum : apexEngine.getInternalContext().getContextAlbums().values()) { - assertTrue( - contextAlbum.getAlbumDefinition().equals(apexModelSample.getAlbums().get(contextAlbum.getKey()))); + assertEquals( + contextAlbum.getAlbumDefinition(), apexModelSample.getAlbums().get(contextAlbum.getKey())); } apexEngine.updateModel(someSpuriousModel, false); assertEquals(apexEngine.getInternalContext().getContextAlbums().size(), someSpuriousModel.getAlbums().getAlbumsMap().size()); for (final ContextAlbum contextAlbum : apexEngine.getInternalContext().getContextAlbums().values()) { - assertTrue( - contextAlbum.getAlbumDefinition().equals(someSpuriousModel.getAlbums().get(contextAlbum.getKey()))); + assertEquals( + contextAlbum.getAlbumDefinition(), someSpuriousModel.getAlbums().get(contextAlbum.getKey())); } apexEngine.clear(); |