diff options
author | a.sreekumar <ajith.sreekumar@bell.ca> | 2020-08-21 13:01:47 +0100 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@bell.ca> | 2020-08-21 13:02:41 +0100 |
commit | 3c83e778bd7d454b92f64ee42e1ce5dd498271f0 (patch) | |
tree | ece47ca25956a2ce5be750e7cb49e1e1f36a882e /main/src/test/java/org | |
parent | 9ebbb7c1ab287841b41fbebe97ba2ad15af3bdc7 (diff) |
Changes to make policy-distribution container crash with non zero exitCode
Change-Id: Ic637253513b349ccb3f17b7c3fce1414bd5ec022
Issue-ID: POLICY-2756
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'main/src/test/java/org')
-rw-r--r-- | main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java index d8bdd98b..4094bd53 100644 --- a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java +++ b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 AT&T Inc. + * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,13 +23,15 @@ package org.onap.policy.distribution.main.startstop; import static org.assertj.core.api.Assertions.assertThatCode; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.io.IOException; import org.junit.Test; +import org.onap.policy.common.utils.resources.MessageConstants; import org.onap.policy.distribution.main.PolicyDistributionException; +import org.onap.policy.distribution.main.PolicyDistributionRuntimeException; import org.onap.policy.distribution.main.parameters.CommonTestData; /** @@ -50,18 +53,18 @@ public class TestMain { @Test public void testMain_NoArguments() { - final String[] distributionConfigParameters = - {}; - final Main main = new Main(distributionConfigParameters); - assertNull(main.getParameters()); + final String[] distributionConfigParameters = {}; + assertThatThrownBy(() -> new Main(distributionConfigParameters)) + .isInstanceOf(PolicyDistributionRuntimeException.class) + .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DISTRIBUTION)); } @Test public void testMain_InvalidArguments() { - final String[] distributionConfigParameters = - { "parameters/DistributionConfigParameters.json" }; - final Main main = new Main(distributionConfigParameters); - assertNull(main.getParameters()); + final String[] distributionConfigParameters = {"parameters/DistributionConfigParameters.json"}; + assertThatThrownBy(() -> new Main(distributionConfigParameters)) + .isInstanceOf(PolicyDistributionRuntimeException.class) + .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DISTRIBUTION)); } @Test @@ -76,8 +79,9 @@ public class TestMain { @Test public void testMain_InvalidParameters() { final String[] distributionConfigParameters = - { "-c", "parameters/DistributionConfigParameters_InvalidName.json" }; - final Main main = new Main(distributionConfigParameters); - assertNull(main.getParameters()); + {"-c", "parameters/DistributionConfigParameters_InvalidName.json"}; + assertThatThrownBy(() -> new Main(distributionConfigParameters)) + .isInstanceOf(PolicyDistributionRuntimeException.class) + .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DISTRIBUTION)); } } |