@Test public void printuserorgan_valid_one_organ() throws OrganAlreadyRegisteredException { Client client = new Client("First", "mid", "Last", LocalDate.of(1970, 1, 1), 1); client.setOrganDonationStatus(Organ.KIDNEY, true); when(spyClientManager.getClientByID(anyInt())).thenReturn(Optional.of(client)); String[] inputs = {"-u", "1", "-t", "donations"}; CommandLine.run(spyPrintClientOrgan, System.out, inputs); assertThat(outContent.toString(), containsString("User: 1. Name: First mid Last. Donation status: Kidney")); }
@Override public void run() { Optional<Client> client = manager.getClientByID(uid); if (!client.isPresent()) { outputStream.println("No client exists with that user ID"); return; } if ("requests".equals(type) || "donations".equals(type)) { outputStream.println(client.get().getClientOrganStatusString(type)); } else { outputStream.println("Define if organs to print are donations or requests e.g. 'printuserorgan " + "-uid=1 -t=requests'"); } }
PrintClientOrgan implements Runnable { @Override public void run() { Optional<Client> client = manager.getClientByID(uid); if (!client.isPresent()) { outputStream.println("No client exists with that user ID"); return; } if ("requests".equals(type) || "donations".equals(type)) { outputStream.println(client.get().getClientOrganStatusString(type)); } else { outputStream.println("Define if organs to print are donations or requests e.g. 'printuserorgan " + "-uid=1 -t=requests'"); } } }
PrintClientOrgan implements Runnable { @Override public void run() { Optional<Client> client = manager.getClientByID(uid); if (!client.isPresent()) { outputStream.println("No client exists with that user ID"); return; } if ("requests".equals(type) || "donations".equals(type)) { outputStream.println(client.get().getClientOrganStatusString(type)); } else { outputStream.println("Define if organs to print are donations or requests e.g. 'printuserorgan " + "-uid=1 -t=requests'"); } } PrintClientOrgan();  PrintClientOrgan(PrintStream outputStream);  PrintClientOrgan(ClientManager manager); }
PrintClientOrgan implements Runnable { @Override public void run() { Optional<Client> client = manager.getClientByID(uid); if (!client.isPresent()) { outputStream.println("No client exists with that user ID"); return; } if ("requests".equals(type) || "donations".equals(type)) { outputStream.println(client.get().getClientOrganStatusString(type)); } else { outputStream.println("Define if organs to print are donations or requests e.g. 'printuserorgan " + "-uid=1 -t=requests'"); } } PrintClientOrgan();  PrintClientOrgan(PrintStream outputStream);  PrintClientOrgan(ClientManager manager); @Override void run(); }
PrintClientOrgan implements Runnable { @Override public void run() { Optional<Client> client = manager.getClientByID(uid); if (!client.isPresent()) { outputStream.println("No client exists with that user ID"); return; } if ("requests".equals(type) || "donations".equals(type)) { outputStream.println(client.get().getClientOrganStatusString(type)); } else { outputStream.println("Define if organs to print are donations or requests e.g. 'printuserorgan " + "-uid=1 -t=requests'"); } } PrintClientOrgan();  PrintClientOrgan(PrintStream outputStream);  PrintClientOrgan(ClientManager manager); @Override void run();  }