Code example for EventBus

0
import com.google.common.collect.ImmutableMap;
import com.google.common.eventbus.EventBus;
 
@Test(groups = "unit", singleThreaded = true, testName = "RunScriptOnNodeAsInitScriptUsingSshTest")
public class RunScriptOnNodeAsInitScriptUsingSshTest { 
   EventBus eventBus = new EventBus();
 
   @Test(expectedExceptions = IllegalStateException.class)
   public void testWithoutInitThrowsIllegalStateException() { 
      Statement command = exec("doFoo"); 
      NodeMetadata node = new NodeMetadataBuilder().ids("id").status(Status.RUNNING).credentials(
               LoginCredentials.builder().user("tester").password("notalot").build()).build(); 
 
      SshClient sshClient = createMock(SshClient.class);
 
      replay(sshClient);
 
      RunScriptOnNodeAsInitScriptUsingSsh testMe = new RunScriptOnNodeAsInitScriptUsingSsh(Functions
               .forMap(ImmutableMap.of(node, sshClient)), eventBus, InitScriptConfigurationForTasks.create()
               .appendIncrementingNumberToAnonymousTaskNames(), node, command, new RunScriptOptions());
Contextual code suggestions in your IDE  Get Codota for Java