Search in sources :

Example 1 with RemoteCallable

use of com.oracle.bedrock.runtime.concurrent.RemoteCallable in project oracle-bedrock by coherence-community.

the class SimpleJUnitTestRunTest method shouldStartTests.

@Test
public void shouldStartTests() throws Exception {
    Platform platform = mock(Platform.class);
    JavaApplicationProcess process = mock(JavaApplicationProcess.class);
    OptionsByType optionsByType = OptionsByType.empty();
    try (SimpleJUnitTestRun application = new SimpleJUnitTestRun(platform, process, optionsByType)) {
        TestClasses testClasses = TestClasses.empty();
        OptionsByType testOptions = OptionsByType.of(testClasses);
        SimpleJUnitTestRun spyApp = spy(application);
        doReturn(null).when(spyApp).submit(any(RemoteCallable.class), anyVararg());
        spyApp.startTests(testOptions);
        ArgumentCaptor<RemoteCallable> captorCallable = ArgumentCaptor.forClass(RemoteCallable.class);
        verify(spyApp).submit(captorCallable.capture(), anyVararg());
        RemoteCallable callable = captorCallable.getValue();
        assertThat(callable, is(instanceOf(JUnitTestRunner.StartTests.class)));
        JUnitTestRunner.StartTests startTests = (JUnitTestRunner.StartTests) callable;
        assertThat(startTests.getOptions(), is(arrayContainingInAnyOrder(testClasses)));
    }
}
Also used : TestClasses(com.oracle.bedrock.testsupport.junit.options.TestClasses) Platform(com.oracle.bedrock.runtime.Platform) RemoteCallable(com.oracle.bedrock.runtime.concurrent.RemoteCallable) JavaApplicationProcess(com.oracle.bedrock.runtime.java.JavaApplicationProcess) SimpleJUnitTestRun(com.oracle.bedrock.testsupport.junit.SimpleJUnitTestRun) OptionsByType(com.oracle.bedrock.OptionsByType) JUnitTestRunner(com.oracle.bedrock.testsupport.junit.JUnitTestRunner) Test(org.junit.Test)

Aggregations

OptionsByType (com.oracle.bedrock.OptionsByType)1 Platform (com.oracle.bedrock.runtime.Platform)1 RemoteCallable (com.oracle.bedrock.runtime.concurrent.RemoteCallable)1 JavaApplicationProcess (com.oracle.bedrock.runtime.java.JavaApplicationProcess)1 JUnitTestRunner (com.oracle.bedrock.testsupport.junit.JUnitTestRunner)1 SimpleJUnitTestRun (com.oracle.bedrock.testsupport.junit.SimpleJUnitTestRun)1 TestClasses (com.oracle.bedrock.testsupport.junit.options.TestClasses)1 Test (org.junit.Test)1