aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceInProgressStatusCommandTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/job/command/ResourceInProgressStatusCommandTest.java')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/ResourceInProgressStatusCommandTest.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceInProgressStatusCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceInProgressStatusCommandTest.java
new file mode 100644
index 000000000..9ec49a2e5
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceInProgressStatusCommandTest.java
@@ -0,0 +1,40 @@
+package org.onap.vid.job.command;
+
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.vid.job.Job;
+import org.onap.vid.job.NextCommand;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+
+public class ResourceInProgressStatusCommandTest {
+
+ @InjectMocks
+ private ResourceInProgressStatusCommand commandUnderTest = new ResourceInProgressStatusCommand();
+
+ @BeforeMethod
+ public void initMocks() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @DataProvider
+ public static Object[][] givenStatusToExpectedStatus() {
+ return new Object[][]{
+ {Job.JobStatus.IN_PROGRESS, Job.JobStatus.IN_PROGRESS},
+ {Job.JobStatus.FAILED, Job.JobStatus.FAILED},
+ {Job.JobStatus.COMPLETED, Job.JobStatus.COMPLETED}
+ };
+ }
+
+ @Test(dataProvider = "givenStatusToExpectedStatus")
+ public void whenGetStatusFromMso_returnExpectedNextCommand(Job.JobStatus jobStatus, Job.JobStatus expectedNextStatus) {
+ NextCommand nextCommand = commandUnderTest.processJobStatus(jobStatus);
+ assertThat(nextCommand.getStatus(), is(expectedNextStatus));
+ assertThat(nextCommand.getCommand(), is(commandUnderTest));
+ }
+}