*/
public class ParallelTest {
@Test
public void testSuccessRequireAll() {
Interpreter interpreter = new Interpreter(null);
ParallelNode parallel = new ParallelNode(ParallelNode.Policy.RequireAll, ParallelNode.Policy.RequireOne);
Node one = create(new Mocker() {
@Override
public void mock(Task spy) {
when(spy.update(anyInt())).thenReturn(Status.RUNNING, Status.SUCCESS);
}
});
Node two = create(new Mocker() {
@Override
public void mock(Task spy) {
when(spy.update(anyInt())).thenReturn(Status.RUNNING, Status.RUNNING, Status.SUCCESS);
}
});
parallel.children().add(one);
parallel.children().add(two);
Task task = interpreter.start(parallel);
interpreter.tick(0);
Assert.assertEquals(Status.RUNNING, task.getStatus());
interpreter.tick(0);