CommandUtil { public Map<Host, CommandResult> executeSequential( RequestBuilder requestBuilder, Set<Host> hosts ) throws CommandException { Preconditions.checkNotNull( requestBuilder ); Preconditions.checkArgument( !CollectionUtil.isCollectionEmpty( hosts ) ); Map<Host, CommandResult> resultMap = Maps.newHashMap(); for ( Host host : hosts ) { resultMap.put( host, host.execute( requestBuilder ) ); } return resultMap; }  CommandResult execute( RequestBuilder requestBuilder, Host host ); CommandResult execute( RequestBuilder requestBuilder, Host host, CommandCallback callback ); void executeAsync( RequestBuilder requestBuilder, Host host, final StoppableCallback callback ); void executeAsync( RequestBuilder requestBuilder, Set<Host> hosts, final CommandCallback callback ); Map<Host, CommandResult> executeSequential( RequestBuilder requestBuilder, Set<Host> hosts ); HostCommandResults execute( final RequestBuilder requestBuilder, Set<Host> hosts, String environmentId ); HostCommandResults executeFailFast( final RequestBuilder requestBuilder, Set<Host> hosts,
                                               String environmentId ); boolean cancelEnvironmentCommands( String environmentId ); void cancelAll(); void dispose();  }
@Test public void testExecuteSequential() throws Exception { when( host.execute( any( RequestBuilder.class ) ) ).thenReturn( commandResult ); commandUtil.executeSequential( requestBuilder, mySet ); }