diff options
2 files changed, 25 insertions, 8 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoBaseTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoBaseTest.java index b25dfb87b9..f59413b347 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoBaseTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoBaseTest.java @@ -20,6 +20,9 @@ package org.openecomp.sdc.be.components.lifecycle; +import static org.assertj.core.api.Assertions.assertThat; + +import mockit.Deencapsulation; import org.junit.Test; public class LifecycleChangeInfoBaseTest { @@ -30,21 +33,26 @@ public class LifecycleChangeInfoBaseTest { @Test public void testGetUserRemarks() throws Exception { + String remarks = "ABC123*"; LifecycleChangeInfoBase testSubject; String result; // default test testSubject = createTestSubject(); + Deencapsulation.setField(testSubject, "userRemarks", remarks); result = testSubject.getUserRemarks(); + assertThat(result).isNotEmpty(); + assertThat(result).isEqualTo(remarks); } @Test public void testSetUserRemarks() throws Exception { LifecycleChangeInfoBase testSubject; - String userRemarks = ""; + String userRemarks = "ABC123*"; // default test testSubject = createTestSubject(); testSubject.setUserRemarks(userRemarks); + assertThat((String)Deencapsulation.getField(testSubject, "userRemarks")).isEqualTo(userRemarks); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoWithActionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoWithActionTest.java index 67e917a4b8..7d794d8b96 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoWithActionTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoWithActionTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,9 +20,12 @@ package org.openecomp.sdc.be.components.lifecycle; +import mockit.Deencapsulation; import org.junit.Test; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum; +import static org.assertj.core.api.Assertions.assertThat; + public class LifecycleChangeInfoWithActionTest { private LifecycleChangeInfoWithAction createTestSubject() { @@ -31,18 +34,22 @@ public class LifecycleChangeInfoWithActionTest { @Test public void testConstructor() throws Exception { - new LifecycleChangeInfoWithAction("mock"); - new LifecycleChangeInfoWithAction("mock", LifecycleChanceActionEnum.CREATE_FROM_CSAR); + LifecycleChangeInfoWithAction obj1 = new LifecycleChangeInfoWithAction("mock"); + LifecycleChangeInfoWithAction obj2 = new LifecycleChangeInfoWithAction("mock", LifecycleChanceActionEnum.CREATE_FROM_CSAR); + assertThat(obj1).isInstanceOf(LifecycleChangeInfoWithAction.class); + assertThat(obj2).isInstanceOf(LifecycleChangeInfoWithAction.class); } - + @Test public void testGetAction() throws Exception { LifecycleChangeInfoWithAction testSubject; - LifecycleChanceActionEnum result; + LifecycleChanceActionEnum action = LifecycleChanceActionEnum.CREATE_FROM_CSAR; // default test testSubject = createTestSubject(); - result = testSubject.getAction(); + Deencapsulation.setField(testSubject, "action", action); + LifecycleChanceActionEnum result = testSubject.getAction(); + assertThat(result).isEqualTo(action); } @Test @@ -53,5 +60,7 @@ public class LifecycleChangeInfoWithActionTest { // default test testSubject = createTestSubject(); testSubject.setAction(action); + LifecycleChanceActionEnum result = Deencapsulation.getField(testSubject, "action"); + assertThat(result).isEqualTo(action); } } |