@Test
public void testWithOneEndedAndOneStillRunning() throws Exception {

    DelegateExecution execution = mock(DelegateExecution.class);
    when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(Lists.newArrayList("1", "2"));
    ProcessVariablesCollector collector = new ProcessVariablesCollector();
    collector.install(execution);
    RuntimeService runtimeService = mockRuntimeService(ImmutableMap.of(
        "1", mockProcessInstance(/* ended= */ true),
        "2", mockProcessInstance(/* ended= */ false)
    ));
    JavaDelegate delegate = new CheckProcessesEnded(runtimeService, PROCESS_IDS, RESULT);
    delegate.execute(execution);
    assertThat((Boolean) collector.getVariable(RESULT)).isFalse();
}