diff options
author | waynedunican <wayne.dunican@est.tech> | 2020-07-24 09:46:36 +0100 |
---|---|---|
committer | waynedunican <wayne.dunican@est.tech> | 2020-07-27 13:28:30 +0100 |
commit | b2e2d5f8daeefb08873d11de44cb4cfe7cfab03a (patch) | |
tree | be45f7f5bf18fe4a1a1b1b430a4089a1d1a316c2 /tools/tools-common/src/test | |
parent | ba58c5bad6075f7bc902de80190cc6770a209bb6 (diff) |
SONAR assertions apex-pdp
Ensure assertions are present in test cases
Issue-ID: POLICY-2706
Change-Id: I3673a7668564401d2136450b0bdd7a013605dd7c
Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'tools/tools-common/src/test')
3 files changed, 12 insertions, 2 deletions
diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java index ab14c66c5..80980bb34 100644 --- a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.java +++ b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/CliParserTest.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. @@ -22,6 +23,7 @@ package org.onap.policy.apex.tools.common; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.Assert.assertNotNull; import org.apache.commons.cli.Option; import org.junit.Test; @@ -42,6 +44,7 @@ public class CliParserTest { @Test public void testappVersion() { final CliParser cli = new CliParser(); + assertNotNull(cli); LOGGER.info(cli.getAppVersion()); } diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java index 2433e3c5c..1dc8d53ef 100644 --- a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java +++ b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.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,13 +21,14 @@ package org.onap.policy.apex.tools.common.docs; +import static org.junit.Assert.assertNotNull; + //// //// NOTE: This file contains tags for ASCIIDOC //// DO NOT REMOVE any of those tag lines, e.g. ////// tag::** ////// end::** //// - import org.apache.commons.cli.CommandLine; import org.junit.Test; import org.onap.policy.apex.tools.common.CliOptions; @@ -51,6 +53,7 @@ public class ExampleAppVersionTest { // tag::setupParser[] final CliParser cli = new CliParser(); cli.addOption(CliOptions.VERSION); + assertNotNull(cli.getOptions()); final CommandLine cmd = cli.parseCli(args); // end::setupParser[] diff --git a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java index 797c7c1e8..c653cd0b2 100644 --- a/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java +++ b/tools/tools-common/src/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.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,6 +21,8 @@ package org.onap.policy.apex.tools.common.docs; +import static org.junit.Assert.assertNotNull; + //// ////NOTE: This file contains tags for ASCIIDOC ////DO NOT REMOVE any of those tag lines, e.g. @@ -28,7 +31,6 @@ package org.onap.policy.apex.tools.common.docs; //// ////DO NOT auto-refresh imports or organise imports! //// - import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.HelpFormatter; import org.junit.Test; @@ -62,9 +64,11 @@ public class ExampleCliParserTest { // tag::setCli[] final CliParser cli = new CliParser(); + assertNotNull(cli); cli.addOption(CliOptions.HELP); cli.addOption(CliOptions.VERSION); cli.addOption(CliOptions.MODELFILE); + assertNotNull(cli.getOptions()); // end::setCli[] // tag::parseCli[] |