@Test public void printallorgan_single_client() throws OrganAlreadyRegisteredException { Client client = new Client("First", "mid", "Last", LocalDate.of(1970, 1, 1), 1); client.setOrganDonationStatus(Organ.LIVER, true); client.setOrganDonationStatus(Organ.KIDNEY, true); List<Client> clients = new ArrayList<>(); clients.add(client); when(spyClientManager.getClients()).thenReturn(clients); String[] inputs = {"-t", "donations"}; CommandLine.run(spyPrintAllOrgan, System.out, inputs); Assertions.assertTrue( outContent.toString().contains("User: 1. Name: First mid Last. Donation status: Kidney, Liver") || outContent.toString() .contains("User: 1. Name: First mid Last. Donation status: Liver, Kidney")); }
@Override public void run() { List<Client> clients = manager.getClients(); if (clients.isEmpty()) { outputStream.println("No clients exist"); } else if ("donations".equals(type) || "requests".equals(type)) { for (Client client : clients) { outputStream.println(client.getClientOrganStatusString(type)); } } else { outputStream.println("Define if organs to print are donations or requests e.g. 'printuserorgan " + "-uid=1 -t=requests'"); } }
PrintAllOrgan implements Runnable { @Override public void run() { List<Client> clients = manager.getClients(); if (clients.isEmpty()) { outputStream.println("No clients exist"); } else if ("donations".equals(type) || "requests".equals(type)) { for (Client client : clients) { outputStream.println(client.getClientOrganStatusString(type)); } } else { outputStream.println("Define if organs to print are donations or requests e.g. 'printuserorgan " + "-uid=1 -t=requests'"); } } }
PrintAllOrgan implements Runnable { @Override public void run() { List<Client> clients = manager.getClients(); if (clients.isEmpty()) { outputStream.println("No clients exist"); } else if ("donations".equals(type) || "requests".equals(type)) { for (Client client : clients) { outputStream.println(client.getClientOrganStatusString(type)); } } else { outputStream.println("Define if organs to print are donations or requests e.g. 'printuserorgan " + "-uid=1 -t=requests'"); } } PrintAllOrgan();  PrintAllOrgan(PrintStream outputStream);  PrintAllOrgan(ClientManager manager); }
PrintAllOrgan implements Runnable { @Override public void run() { List<Client> clients = manager.getClients(); if (clients.isEmpty()) { outputStream.println("No clients exist"); } else if ("donations".equals(type) || "requests".equals(type)) { for (Client client : clients) { outputStream.println(client.getClientOrganStatusString(type)); } } else { outputStream.println("Define if organs to print are donations or requests e.g. 'printuserorgan " + "-uid=1 -t=requests'"); } } PrintAllOrgan();  PrintAllOrgan(PrintStream outputStream);  PrintAllOrgan(ClientManager manager); @Override void run(); }
PrintAllOrgan implements Runnable { @Override public void run() { List<Client> clients = manager.getClients(); if (clients.isEmpty()) { outputStream.println("No clients exist"); } else if ("donations".equals(type) || "requests".equals(type)) { for (Client client : clients) { outputStream.println(client.getClientOrganStatusString(type)); } } else { outputStream.println("Define if organs to print are donations or requests e.g. 'printuserorgan " + "-uid=1 -t=requests'"); } } PrintAllOrgan();  PrintAllOrgan(PrintStream outputStream);  PrintAllOrgan(ClientManager manager); @Override void run();  }