1 package org.onap.vid.job.command;
3 import org.mockito.InjectMocks;
4 import org.mockito.MockitoAnnotations;
5 import org.onap.vid.job.Job;
6 import org.onap.vid.job.NextCommand;
7 import org.testng.annotations.BeforeMethod;
8 import org.testng.annotations.DataProvider;
9 import org.testng.annotations.Test;
11 import static org.hamcrest.MatcherAssert.assertThat;
12 import static org.hamcrest.core.Is.is;
15 public class ResourceInProgressStatusCommandTest {
18 private ResourceInProgressStatusCommand commandUnderTest = new ResourceInProgressStatusCommand();
21 public void initMocks() {
22 MockitoAnnotations.initMocks(this);
26 public static Object[][] givenStatusToExpectedStatus() {
27 return new Object[][]{
28 {Job.JobStatus.IN_PROGRESS, Job.JobStatus.IN_PROGRESS},
29 {Job.JobStatus.FAILED, Job.JobStatus.FAILED},
30 {Job.JobStatus.COMPLETED, Job.JobStatus.COMPLETED}
34 @Test(dataProvider = "givenStatusToExpectedStatus")
35 public void whenGetStatusFromMso_returnExpectedNextCommand(Job.JobStatus jobStatus, Job.JobStatus expectedNextStatus) {
36 NextCommand nextCommand = commandUnderTest.processJobStatus(jobStatus);
37 assertThat(nextCommand.getStatus(), is(expectedNextStatus));
38 assertThat(nextCommand.getCommand(), is(commandUnderTest));