### Question:
ExitCommand implements Command { @Override public void run(Line line) throws Exception { shell.stop(); } ExitCommand(Shell shell); @Override String name(); @Override Usage usage(); @Override void run(Line line);  }### Answer:
@Test public void testRun() throws Exception { Shell shell = new Shell(); ExitCommand command = new ExitCommand(shell); Field field = Shell.class.getDeclaredField("repl"); field.setAccessible(true); AtomicBoolean repl = (AtomicBoolean) field.get(shell); repl.set(true); assertTrue(shell.started()); command.run(new Line("exit")); assertFalse(shell.started()); }