use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.
the class SimpleJUnitTestRunTest method fireEvent.
public void fireEvent(JUnitTestListener.Event event, JUnitTestListener... listeners) throws Exception {
Platform platform = mock(Platform.class);
JavaApplicationProcess process = mock(JavaApplicationProcess.class);
OptionsByType optionsByType = OptionsByType.empty();
for (JUnitTestListener listener : listeners) {
optionsByType.add(Decoration.of(listener));
}
try (SimpleJUnitTestRun application = new SimpleJUnitTestRun(platform, process, optionsByType)) {
ArgumentCaptor<RemoteEventListener> captorListener = ArgumentCaptor.forClass(RemoteEventListener.class);
ArgumentCaptor<Option> captorOptions = ArgumentCaptor.forClass(Option.class);
verify(process).addListener(captorListener.capture(), captorOptions.capture());
RemoteEventListener eventListener = captorListener.getValue();
List<Option> listenerOpts = captorOptions.getAllValues();
assertThat(eventListener, is(notNullValue()));
assertThat(listenerOpts, containsInAnyOrder(JUnitTestRunner.STREAM_NAME));
eventListener.onEvent(event);
}
}
Aggregations