@Test public void testExecute_emptyAgentList() throws Exception { AgentStatusCommand cmd = new AgentStatusCommand(); cmd.agents = new ArrayList<>( 0 ); Assert.assertNull( cmd.execute()); }
@Override public Object execute() throws Exception { if( this.agents != null ) { for( AgentMessagingInterface agent : this.agents ) { try { System.out.println( agent.agentStatus()); System.out.println( "" ); } catch( Exception e ) { this.logger.warning( "An error occurred while giving agent status. " + e.getMessage()); Utils.logException( this.logger, e ); } } } return null; }
AgentStatusCommand implements Action { @Override public Object execute() throws Exception { if( this.agents != null ) { for( AgentMessagingInterface agent : this.agents ) { try { System.out.println( agent.agentStatus()); System.out.println( "" ); } catch( Exception e ) { this.logger.warning( "An error occurred while giving agent status. " + e.getMessage()); Utils.logException( this.logger, e ); } } } return null; } }
AgentStatusCommand implements Action { @Override public Object execute() throws Exception { if( this.agents != null ) { for( AgentMessagingInterface agent : this.agents ) { try { System.out.println( agent.agentStatus()); System.out.println( "" ); } catch( Exception e ) { this.logger.warning( "An error occurred while giving agent status. " + e.getMessage()); Utils.logException( this.logger, e ); } } } return null; }  }
AgentStatusCommand implements Action { @Override public Object execute() throws Exception { if( this.agents != null ) { for( AgentMessagingInterface agent : this.agents ) { try { System.out.println( agent.agentStatus()); System.out.println( "" ); } catch( Exception e ) { this.logger.warning( "An error occurred while giving agent status. " + e.getMessage()); Utils.logException( this.logger, e ); } } } return null; }  @Override Object execute(); }
AgentStatusCommand implements Action { @Override public Object execute() throws Exception { if( this.agents != null ) { for( AgentMessagingInterface agent : this.agents ) { try { System.out.println( agent.agentStatus()); System.out.println( "" ); } catch( Exception e ) { this.logger.warning( "An error occurred while giving agent status. " + e.getMessage()); Utils.logException( this.logger, e ); } } } return null; }  @Override Object execute();  }