@Test public void resolveInvalidParam1() { TransplantRequest tr = new TransplantRequest(testClient, Organ.LIVER); testClient.addTransplantRequest(tr); String[] inputs = {"-u", "1", "-o", "liver", "-r", "ops this input is invalid"}; CommandLine.run(spyResolveOrgan, System.out, inputs); assertTrue(tr.getStatus() == TransplantRequestStatus.WAITING); }
@Override public void run() { Optional<Client> optionalClient = manager.getClientByID(uid); Client client; if (!optionalClient.isPresent()) { outputStream.println("No client exists with that user ID"); return; } else { client = optionalClient.get(); } TransplantRequest selectedTransplantRequest = null; for (TransplantRequest tr : client.getTransplantRequests()) { if (tr.getRequestedOrgan() == organType && tr.getStatus() == TransplantRequestStatus.WAITING) { selectedTransplantRequest = tr; break; } } if (selectedTransplantRequest == null) { outputStream.println(client.getFullName() + " is not currently requesting this organ."); } else { resolveRequest(selectedTransplantRequest); } }
ResolveOrgan implements Runnable { @Override public void run() { Optional<Client> optionalClient = manager.getClientByID(uid); Client client; if (!optionalClient.isPresent()) { outputStream.println("No client exists with that user ID"); return; } else { client = optionalClient.get(); } TransplantRequest selectedTransplantRequest = null; for (TransplantRequest tr : client.getTransplantRequests()) { if (tr.getRequestedOrgan() == organType && tr.getStatus() == TransplantRequestStatus.WAITING) { selectedTransplantRequest = tr; break; } } if (selectedTransplantRequest == null) { outputStream.println(client.getFullName() + " is not currently requesting this organ."); } else { resolveRequest(selectedTransplantRequest); } } }
ResolveOrgan implements Runnable { @Override public void run() { Optional<Client> optionalClient = manager.getClientByID(uid); Client client; if (!optionalClient.isPresent()) { outputStream.println("No client exists with that user ID"); return; } else { client = optionalClient.get(); } TransplantRequest selectedTransplantRequest = null; for (TransplantRequest tr : client.getTransplantRequests()) { if (tr.getRequestedOrgan() == organType && tr.getStatus() == TransplantRequestStatus.WAITING) { selectedTransplantRequest = tr; break; } } if (selectedTransplantRequest == null) { outputStream.println(client.getFullName() + " is not currently requesting this organ."); } else { resolveRequest(selectedTransplantRequest); } } ResolveOrgan(PrintStream outputStream, ActionInvoker invoker);  ResolveOrgan(ClientManager manager, ActionInvoker invoker); }
ResolveOrgan implements Runnable { @Override public void run() { Optional<Client> optionalClient = manager.getClientByID(uid); Client client; if (!optionalClient.isPresent()) { outputStream.println("No client exists with that user ID"); return; } else { client = optionalClient.get(); } TransplantRequest selectedTransplantRequest = null; for (TransplantRequest tr : client.getTransplantRequests()) { if (tr.getRequestedOrgan() == organType && tr.getStatus() == TransplantRequestStatus.WAITING) { selectedTransplantRequest = tr; break; } } if (selectedTransplantRequest == null) { outputStream.println(client.getFullName() + " is not currently requesting this organ."); } else { resolveRequest(selectedTransplantRequest); } } ResolveOrgan(PrintStream outputStream, ActionInvoker invoker);  ResolveOrgan(ClientManager manager, ActionInvoker invoker); @Override void run(); }
ResolveOrgan implements Runnable { @Override public void run() { Optional<Client> optionalClient = manager.getClientByID(uid); Client client; if (!optionalClient.isPresent()) { outputStream.println("No client exists with that user ID"); return; } else { client = optionalClient.get(); } TransplantRequest selectedTransplantRequest = null; for (TransplantRequest tr : client.getTransplantRequests()) { if (tr.getRequestedOrgan() == organType && tr.getStatus() == TransplantRequestStatus.WAITING) { selectedTransplantRequest = tr; break; } } if (selectedTransplantRequest == null) { outputStream.println(client.getFullName() + " is not currently requesting this organ."); } else { resolveRequest(selectedTransplantRequest); } } ResolveOrgan(PrintStream outputStream, ActionInvoker invoker);  ResolveOrgan(ClientManager manager, ActionInvoker invoker); @Override void run();  }