### Question:
Drop extends ConsoleCommand { @Override public void execute(String... tokens) throws IOException { if (tokens.length < 2) { consoleIO.writeln(getHelpLong()); } else { final String repoID = tokens[1]; try { dropRepository(repoID); } catch (RepositoryConfigException e) { consoleIO.writeError("Unable to drop repository '" + repoID + "': " + e.getMessage()); LOGGER.warn("Unable to drop repository '" + repoID + "'", e); } catch (RepositoryReadOnlyException e) { try { if (LockRemover.tryToRemoveLock(state.getManager().getSystemRepository(), consoleIO)) { execute(tokens); } else { consoleIO.writeError("Failed to drop repository"); LOGGER.error("Failed to drop repository", e); } } catch (RepositoryException e2) { consoleIO.writeError("Failed to restart system: " + e2.getMessage()); LOGGER.error("Failed to restart system", e2); } } catch (RepositoryException e) { consoleIO.writeError("Failed to update configuration in system repository: " + e.getMessage()); LOGGER.warn("Failed to update configuration in system repository", e); } } } Drop(ConsoleIO consoleIO, ConsoleState state, Close close); @Override String getName(); @Override String getHelpShort(); @Override String getHelpLong(); @Override void execute(String... tokens);  }### Answer:
@Test public final void testSafeDrop() throws RepositoryException, IOException { setUserDropConfirm(true); assertThat(manager.isSafeToRemove(PROXY_ID)).isTrue(); drop.execute("drop", PROXY_ID); verify(mockConsoleIO).writeln("Dropped repository '" + PROXY_ID + "'"); assertThat(manager.isSafeToRemove(MEMORY_MEMBER_ID1)).isTrue(); drop.execute("drop", MEMORY_MEMBER_ID1); verify(mockConsoleIO).writeln("Dropped repository '" + MEMORY_MEMBER_ID1 + "'"); }
@Test public final void testUnsafeDropCancel() throws RepositoryException, IOException { setUserDropConfirm(true); assertThat(manager.isSafeToRemove(MEMORY_MEMBER_ID1)).isFalse(); when(mockConsoleIO.askProceed(startsWith("WARNING: dropping this repository may break"), anyBoolean())) .thenReturn(false); drop.execute("drop", MEMORY_MEMBER_ID1); verify(mockConsoleIO).writeln("Drop aborted"); }
@Test public final void testUserAbortedUnsafeDropBeforeWarning() throws IOException { setUserDropConfirm(false); drop.execute("drop", MEMORY_MEMBER_ID1); verify(mockConsoleIO, never()).askProceed(startsWith("WARNING: dropping this repository may break"), anyBoolean()); verify(mockConsoleIO).writeln("Drop aborted"); }