### Question:
CommandManager implements Reportable { void handleCommand(CommandStatus cmd) { try { if (cmd == null) { return; } cmd.toExecing(""); exec(cmd.cmd); cmd.toSucceeded(""); } catch (MasterExecException e) { LOG.warn("During " + cmd + " : " + e.getMessage()); cmd.toFailed(e.getMessage()); } catch (Exception e) { LOG.error("Unexpected exception during " + cmd + " : " + e.getMessage(), e); cmd.toFailed(e.getMessage()); } } CommandManager();   CommandManager(Object[][] cmdArray); void addCommand(String cmd, Execable ex); synchronized void start(); synchronized void stop(); long submit(Command cmd); boolean isSuccess(long cmdid); boolean isFailure(long cmdid); @Override String getName(); CommandStatus getStatus(long id); @Override ReportEvent getReport();  }### Answer:
@Test public void testHandleCommand() { Execable ex = new Execable() { @Override public void exec(String[] args) throws MasterExecException, IOException { throw new IllegalArgumentException("failure here"); } }; CommandManager cmdman = new CommandManager(); cmdman.addCommand("err", ex); cmdman.handleCommand(null); long id = cmdman.submit(new Command("err")); CommandStatus stat = cmdman.getStatus(id); cmdman.handleCommand(stat); assertTrue(cmdman.isFailure(id)); id = cmdman.submit(new Command("noop")); stat = cmdman.getStatus(id); cmdman.handleCommand(stat); assertTrue(cmdman.isSuccess(id)); }