From b2e2d5f8daeefb08873d11de44cb4cfe7cfab03a Mon Sep 17 00:00:00 2001 From: waynedunican Date: Fri, 24 Jul 2020 09:46:36 +0100 Subject: SONAR assertions apex-pdp Ensure assertions are present in test cases Issue-ID: POLICY-2706 Change-Id: I3673a7668564401d2136450b0bdd7a013605dd7c Signed-off-by: waynedunican --- .../test/java/org/onap/policy/apex/tools/common/CliParserTest.java | 3 +++ .../onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java | 5 ++++- .../onap/policy/apex/tools/common/docs/ExampleCliParserTest.java | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'tools/tools-common/src') 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[] -- cgit 1.2.3-korg