@Test public void testDeleteDefault() { doNothing().when(spyClinicianManager).removeClinician(any()); String[] inputs = {"-s", "0"}; CommandLine.run(spyDeleteClinician, System.out, inputs); Mockito.verify(spyClinicianManager, times(0)).removeClinician(any()); }
@Override public void run() { Optional<Clinician> clinician = manager.getClinicianByStaffId(id); if (!clinician.isPresent()) { outputStream.println("No clinician exists with that user ID"); } else if (clinician.get().getStaffId() == manager.getDefaultClinician().getStaffId()) { outputStream.println("Default clinician cannot be deleted"); } else if (!yes) { outputStream.println( String.format("Removing clinician: %s, with staff id: %s,\nto proceed please rerun the command " + "with the -y flag", clinician.get().getFullName(), clinician.get().getStaffId())); } else { Action action = new DeleteClinicianAction(clinician.get(), manager); outputStream.println(invoker.execute(action)); outputStream.println("This removal will only be permanent once the 'save' command is used"); } }
DeleteClinician implements Runnable { @Override public void run() { Optional<Clinician> clinician = manager.getClinicianByStaffId(id); if (!clinician.isPresent()) { outputStream.println("No clinician exists with that user ID"); } else if (clinician.get().getStaffId() == manager.getDefaultClinician().getStaffId()) { outputStream.println("Default clinician cannot be deleted"); } else if (!yes) { outputStream.println( String.format("Removing clinician: %s, with staff id: %s,\nto proceed please rerun the command " + "with the -y flag", clinician.get().getFullName(), clinician.get().getStaffId())); } else { Action action = new DeleteClinicianAction(clinician.get(), manager); outputStream.println(invoker.execute(action)); outputStream.println("This removal will only be permanent once the 'save' command is used"); } } }
DeleteClinician implements Runnable { @Override public void run() { Optional<Clinician> clinician = manager.getClinicianByStaffId(id); if (!clinician.isPresent()) { outputStream.println("No clinician exists with that user ID"); } else if (clinician.get().getStaffId() == manager.getDefaultClinician().getStaffId()) { outputStream.println("Default clinician cannot be deleted"); } else if (!yes) { outputStream.println( String.format("Removing clinician: %s, with staff id: %s,\nto proceed please rerun the command " + "with the -y flag", clinician.get().getFullName(), clinician.get().getStaffId())); } else { Action action = new DeleteClinicianAction(clinician.get(), manager); outputStream.println(invoker.execute(action)); outputStream.println("This removal will only be permanent once the 'save' command is used"); } } DeleteClinician(PrintStream outputStream, ActionInvoker invoker);  DeleteClinician(ClinicianManager manager, ActionInvoker invoker); }
DeleteClinician implements Runnable { @Override public void run() { Optional<Clinician> clinician = manager.getClinicianByStaffId(id); if (!clinician.isPresent()) { outputStream.println("No clinician exists with that user ID"); } else if (clinician.get().getStaffId() == manager.getDefaultClinician().getStaffId()) { outputStream.println("Default clinician cannot be deleted"); } else if (!yes) { outputStream.println( String.format("Removing clinician: %s, with staff id: %s,\nto proceed please rerun the command " + "with the -y flag", clinician.get().getFullName(), clinician.get().getStaffId())); } else { Action action = new DeleteClinicianAction(clinician.get(), manager); outputStream.println(invoker.execute(action)); outputStream.println("This removal will only be permanent once the 'save' command is used"); } } DeleteClinician(PrintStream outputStream, ActionInvoker invoker);  DeleteClinician(ClinicianManager manager, ActionInvoker invoker); @Override void run(); }
DeleteClinician implements Runnable { @Override public void run() { Optional<Clinician> clinician = manager.getClinicianByStaffId(id); if (!clinician.isPresent()) { outputStream.println("No clinician exists with that user ID"); } else if (clinician.get().getStaffId() == manager.getDefaultClinician().getStaffId()) { outputStream.println("Default clinician cannot be deleted"); } else if (!yes) { outputStream.println( String.format("Removing clinician: %s, with staff id: %s,\nto proceed please rerun the command " + "with the -y flag", clinician.get().getFullName(), clinician.get().getStaffId())); } else { Action action = new DeleteClinicianAction(clinician.get(), manager); outputStream.println(invoker.execute(action)); outputStream.println("This removal will only be permanent once the 'save' command is used"); } } DeleteClinician(PrintStream outputStream, ActionInvoker invoker);  DeleteClinician(ClinicianManager manager, ActionInvoker invoker); @Override void run();  }