diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2018-07-24 18:01:51 +0530 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2018-07-24 20:03:01 +0000 |
commit | 1f726005765299ffa1552a857dc1b5aaeedcfbad (patch) | |
tree | 510ef28c898c875a77e3c05669fb5abb024cf7c9 | |
parent | a443497c24c45341b8c7090aa43488695c81e75a (diff) |
added test case to PreCheckTest.java
added test case to increase code coverage
Issue-ID: APPC-1086
Change-Id: I51aff34afc47db330c773431d59a5e30cea74d79
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
-rw-r--r-- | appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java | 159 |
1 files changed, 87 insertions, 72 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java index 2865c18e0..80e038440 100644 --- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java +++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/data/PreCheckTest.java @@ -1,72 +1,87 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ============LICENSE_END=========================================================
- */
-package org.onap.appc.flow.controller.data;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class PreCheckTest {
-
- private PreCheck preCheck;
-
- @Before
- public void SetUp() {
- preCheck = new PreCheck();
- }
-
- @Test
- public void testSetPrecheckOperator() {
- preCheck.setPrecheckOperator("op");
- assertNotNull(preCheck.getPrecheckOperator());
- assertEquals(preCheck.getPrecheckOperator(),"op");
- }
-
- @Test
- public void testSetPrecheckOptions() {
- List<PrecheckOption> precheckOptionList = new LinkedList<>();
- preCheck.setPrecheckOptions(precheckOptionList);
- assertNotNull(preCheck.getPrecheckOptions());
- assertEquals(preCheck.getPrecheckOptions(), precheckOptionList);
- }
-
- @Test
- public void testHashCode() {
- preCheck.setPrecheckOperator("1");
- System.out.println(" precheck hashcode is " + preCheck.hashCode());
- }
-
- @Test
- public void testToString() {
- preCheck.setPrecheckOperator("A");
- List<PrecheckOption> precheckOptionList = new LinkedList<>();
- preCheck.setPrecheckOptions(precheckOptionList);
- String ret = preCheck.toString();
- System.out.println("ret is " + ret);
-
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ============================================================================= + * Modifications Copyright (C) 2018 IBM. + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END========================================================= + */ +package org.onap.appc.flow.controller.data; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.LinkedList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +public class PreCheckTest { + + private PreCheck preCheck; + private PreCheck preCheck1; + private PreCheck preCheck2; + + @Before + public void SetUp() { + preCheck = new PreCheck(); + preCheck1 = new PreCheck(); + preCheck2 = new PreCheck(); + } + + @Test + public void testSetPrecheckOperator() { + preCheck.setPrecheckOperator("op"); + assertNotNull(preCheck.getPrecheckOperator()); + assertEquals(preCheck.getPrecheckOperator(),"op"); + } + + @Test + public void testSetPrecheckOptions() { + List<PrecheckOption> precheckOptionList = new LinkedList<>(); + preCheck.setPrecheckOptions(precheckOptionList); + assertNotNull(preCheck.getPrecheckOptions()); + assertEquals(preCheck.getPrecheckOptions(), precheckOptionList); + } + + @Test + public void testHashCode() { + preCheck.setPrecheckOperator("1"); + System.out.println(" precheck hashcode is " + preCheck.hashCode()); + } + + @Test + public void testToString() { + preCheck.setPrecheckOperator("A"); + List<PrecheckOption> precheckOptionList = new LinkedList<>(); + preCheck.setPrecheckOptions(precheckOptionList); + String ret = preCheck.toString(); + System.out.println("ret is " + ret); + + } + + @Test + public void testEqualsObject() { + assertTrue(preCheck1.equals(preCheck2) && preCheck2.equals(preCheck1)); + assertTrue(preCheck1.equals(preCheck1)); + assertFalse(preCheck1.equals(null)); + } + +} |