Merge from ECOMP's repository
[vid.git] / vid-app-common / src / test / java / org / onap / vid / job / command / ResourceInProgressStatusCommandTest.java
1 package org.onap.vid.job.command;
2
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;
10
11 import static org.hamcrest.MatcherAssert.assertThat;
12 import static org.hamcrest.core.Is.is;
13
14
15 public class ResourceInProgressStatusCommandTest {
16
17     @InjectMocks
18     private ResourceInProgressStatusCommand commandUnderTest = new ResourceInProgressStatusCommand();
19
20     @BeforeMethod
21     public void initMocks() {
22         MockitoAnnotations.initMocks(this);
23     }
24
25     @DataProvider
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}
31         };
32     }
33
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));
39     }
40 }