}
@Test
public void testTwoChildrenContinues() {
final Task[] spies = new Task[2];
Interpreter interpreter = new Interpreter(null);
Node one = create(new Mocker() {
@Override
public void mock(Task spy) {
when(spy.update(anyInt())).thenReturn(Status.RUNNING, Status.SUCCESS);
spies[0] = spy;
}
});
Node two = create(new Mocker() {
@Override
public void mock(Task spy) {
when(spy.update(anyInt())).thenReturn(Status.RUNNING);
spies[1] = spy;
}
});
SequenceNode node = new SequenceNode();
node.children().add(one);
node.children().add(two);
Task selector = interpreter.start(node);
interpreter.tick(0);
Assert.assertEquals(Status.RUNNING, selector.getStatus());
interpreter.tick(0);
Assert.assertEquals(Status.RUNNING, selector.getStatus());
interpreter.tick(0);
Assert.assertEquals(Status.RUNNING, selector.getStatus());
verify(spies[0]).onTerminate(Status.SUCCESS);
verify(spies[1]).onInitialize();
}