aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfoTest.java67
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentDeactivateInfoTest.java44
2 files changed, 52 insertions, 59 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfoTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfoTest.java
index 2a69e0e79..131e5dd46 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfoTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfoTest.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,45 +20,48 @@
package org.onap.vid.mso.model;
-import org.junit.Test;
import org.onap.vid.controller.OperationalEnvironmentController;
-import org.onap.vid.controller.OperationalEnvironmentController.OperationalEnvironmentActivateBody;
import org.onap.vid.controller.OperationalEnvironmentController.OperationalEnvironmentManifest;
+import org.testng.annotations.Test;
-public class OperationalEnvironmentActivateInfoTest {
+import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
- private OperationalEnvironmentActivateInfo createTestSubject() {
- OperationalEnvironmentController.OperationalEnvironmentActivateBody a = new OperationalEnvironmentActivateBody("a", "b", "c", new OperationalEnvironmentManifest());
- return new OperationalEnvironmentActivateInfo(a, "", "");
- }
+public class OperationalEnvironmentActivateInfoTest {
@Test
- public void testGetUserId() throws Exception {
- OperationalEnvironmentActivateInfo testSubject;
- String result;
+ public void shouldProperlyCreateOperationalEnvironmentActivateInfoWithParameters() {
+ // given
+ String relatedInstanceId = "testRelatedInstanceId";
+ String relatedInstanceName = "testRelatedInstanceName";
+ String workloadContext = "testWorkloadContext";
+ OperationalEnvironmentManifest manifest = new OperationalEnvironmentManifest();
- // default test
- testSubject = createTestSubject();
- result = testSubject.getUserId();
- }
+ String userId = "testUserId";
+ String operationalEnvironmentId = "testOperationalEnvironmentId";
- @Test
- public void testGetOperationalEnvironmentId() throws Exception {
- OperationalEnvironmentActivateInfo testSubject;
- String result;
+ OperationalEnvironmentController.OperationalEnvironmentActivateBody operationalEnvironmentActivateBody =
+ new OperationalEnvironmentController.OperationalEnvironmentActivateBody
+ (relatedInstanceId,relatedInstanceName,workloadContext,manifest);
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOperationalEnvironmentId();
- }
+ // when
+ OperationalEnvironmentActivateInfo operationalEnvironmentActivateInfo =
+ new OperationalEnvironmentActivateInfo(operationalEnvironmentActivateBody, userId, operationalEnvironmentId);
- @Test
- public void testToString() throws Exception {
- OperationalEnvironmentActivateInfo testSubject;
- String result;
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
+ // then
+ assertThat(operationalEnvironmentActivateInfo.getUserId()).isEqualTo(userId);
+ assertThat(operationalEnvironmentActivateInfo.getOperationalEnvironmentId()).isEqualTo(operationalEnvironmentId);
+
+ assertThat(operationalEnvironmentActivateInfo.toString()).isEqualToIgnoringWhitespace(
+ "OperationalEnvironmentActivateInfo{operationalEnvironmentId="+operationalEnvironmentId+"," +
+ " userId="+userId+"," +
+ " super=OperationalEnvironmentActivateInfo{" +
+ " relatedInstanceId="+relatedInstanceId+"," +
+ " relatedInstanceName="+relatedInstanceName+"," +
+ " workloadContext="+workloadContext+"," +
+ " manifest="+manifest.toString()+"}}"
+ );
+
}
-}
+
+} \ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentDeactivateInfoTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentDeactivateInfoTest.java
index 22310d2e2..72fb9d6dc 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentDeactivateInfoTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/model/OperationalEnvironmentDeactivateInfoTest.java
@@ -20,41 +20,31 @@
package org.onap.vid.mso.model;
-import org.junit.Test;
+import org.testng.annotations.Test;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
public class OperationalEnvironmentDeactivateInfoTest {
- private OperationalEnvironmentDeactivateInfo createTestSubject() {
- return new OperationalEnvironmentDeactivateInfo("", "");
- }
-
@Test
- public void testGetUserId() throws Exception {
- OperationalEnvironmentDeactivateInfo testSubject;
- String result;
+ public void shouldProperlyCreateOperationalEnvironmentActivateInfoWithParameters() {
+ // given
+ String userId = "testUserId";
+ String operationalEnvironmentId = "testOperationalEnvironmentId";
- // default test
- testSubject = createTestSubject();
- result = testSubject.getUserId();
- }
- @Test
- public void testGetOperationalEnvironmentId() throws Exception {
- OperationalEnvironmentDeactivateInfo testSubject;
- String result;
+ // when
+ OperationalEnvironmentDeactivateInfo operationalEnvironmentDeactivateInfo =
+ new OperationalEnvironmentDeactivateInfo(userId, operationalEnvironmentId);
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOperationalEnvironmentId();
- }
- @Test
- public void testToString() throws Exception {
- OperationalEnvironmentDeactivateInfo testSubject;
- String result;
+ // then
+ assertThat(operationalEnvironmentDeactivateInfo.getUserId()).isEqualTo(userId);
+ assertThat(operationalEnvironmentDeactivateInfo.getOperationalEnvironmentId()).isEqualTo(operationalEnvironmentId);
+
+ assertThat(operationalEnvironmentDeactivateInfo.toString()).isEqualToIgnoringWhitespace(
+ "OperationalEnvironmentDeactivateInfo{operationalEnvironmentId="+operationalEnvironmentId+"," +
+ " userId="+userId+"}"
+ );
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
}
}