From 134ca5667da901a703ecb0c78d96873712a9d0d3 Mon Sep 17 00:00:00 2001 From: xuegao Date: Mon, 22 Mar 2021 11:22:47 +0100 Subject: Improve test coverage Add unit tests to improve test coverage. Issue-ID: SDC-3428 Change-Id: I9e00af2824366ae45d47d2dcecf322fd3e9a6fea Signed-off-by: xuegao --- .../migration/core/task/MigrationResultTest.java | 43 +++++++++++----------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'asdctool/src') diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/task/MigrationResultTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/task/MigrationResultTest.java index 4ac5a9fdc6..75c974b2a9 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/task/MigrationResultTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/task/MigrationResultTest.java @@ -20,9 +20,11 @@ package org.openecomp.sdc.asdctool.migration.core.task; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult.MigrationStatus; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class MigrationResultTest { @@ -32,27 +34,13 @@ public class MigrationResultTest { @Test - public void testGetMsg() { - MigrationResult testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getMsg(); - } - - - @Test - public void testSetMsg() { - MigrationResult testSubject; - String msg = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setMsg(msg); + public void testMsg() { + MigrationResult testSubject = createTestSubject(); + assertNull(testSubject.getMsg()); + testSubject.setMsg("msg"); + assertEquals("msg", testSubject.getMsg()); } - @Test public void testGetMigrationStatus() { MigrationResult testSubject; @@ -63,7 +51,6 @@ public class MigrationResultTest { result = testSubject.getMigrationStatus(); } - @Test public void testSetMigrationStatus() { MigrationResult testSubject; @@ -73,4 +60,18 @@ public class MigrationResultTest { testSubject = createTestSubject(); testSubject.setMigrationStatus(migrationStatus); } + + @Test + public void testSuccess() { + MigrationResult testSubject = createTestSubject(); + assertEquals(MigrationResult.MigrationStatus.COMPLETED, testSubject.success().getMigrationStatus()); + } + + @Test + public void testError() { + MigrationResult testSubject = createTestSubject(); + MigrationResult result = testSubject.error("testErr"); + assertEquals(MigrationStatus.FAILED, result.getMigrationStatus()); + assertEquals("testErr", result.getMsg()); + } } -- cgit 1.2.3-korg