blob: 9ec49a2e518552c5b28a2b287a800f4a4b88e8ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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));
}
}
|