diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2021-04-15 10:35:00 +0100 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2021-04-19 09:41:25 +0100 |
commit | a250c0c7a4a680c15cc4cb158f8f3cff53619f1b (patch) | |
tree | 675a8b10876f0d19abad12d86e1c67688682bf3a /models-sim/models-sim-dmaap/src/test/java | |
parent | 0b7b94b17340406b34817d6088daa97d965d5c2c (diff) |
Refactor CommandLineArguments classes
All CMD Args simulator classes to extend from CMD class on Common.
Fix all unit tests accordingly.
Issue-ID: POLICY-3129
Change-Id: If69e432679772df15b06ce7e316c7c876b69773d
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'models-sim/models-sim-dmaap/src/test/java')
2 files changed, 14 insertions, 3 deletions
diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/DmaapSimParameterHandlerTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/DmaapSimParameterHandlerTest.java index 8f053d219..ca6712388 100644 --- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/DmaapSimParameterHandlerTest.java +++ b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/parameters/DmaapSimParameterHandlerTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 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,6 +25,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Before; import org.junit.Test; +import org.onap.policy.common.utils.cmd.CommandLineException; import org.onap.policy.models.sim.dmaap.DmaapSimException; import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterGroup; import org.onap.policy.models.sim.dmaap.parameters.DmaapSimParameterHandler; @@ -41,7 +43,7 @@ public class DmaapSimParameterHandlerTest { } @Test - public void testGetParameters() throws DmaapSimException { + public void testGetParameters() throws DmaapSimException, CommandLineException { final DmaapSimCommandLineArguments args = new DmaapSimCommandLineArguments(); args.parse(new String[] {"-c", RESOURCE_DIR + "NormalParameters.json"}); @@ -66,5 +68,4 @@ public class DmaapSimParameterHandlerTest { assertThatThrownBy(() -> handler.getParameters(args)).isInstanceOf(DmaapSimException.class) .hasMessageContaining("validation error"); } - } diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java index cceeaf5af..1d6c68a49 100644 --- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java +++ b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/sim/dmaap/startstop/MainTest.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= - * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. + * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. + * Modifications Copyright (C) 2021 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,7 @@ package org.onap.policy.sim.dmaap.startstop; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -30,6 +32,7 @@ import org.junit.Before; import org.junit.Test; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.models.sim.dmaap.rest.CommonRestServer; +import org.onap.policy.models.sim.dmaap.startstop.DmaapSimCommandLineArguments; import org.onap.policy.models.sim.dmaap.startstop.Main; import org.onap.policy.sim.dmaap.parameters.CommonTestData; @@ -102,4 +105,11 @@ public class MainTest extends CommonRestServer { main = new Main(NormalParameters); assertNull(main.getParameters()); } + + @Test + public void testDmaapSimVersion() { + String[] testArgs = {"-v"}; + DmaapSimCommandLineArguments sutArgs = new DmaapSimCommandLineArguments(testArgs); + assertThat(sutArgs.version()).startsWith("ONAP DMaaP simulator Service"); + } } |