@Test public void printallorgan_no_clients() { List<Client> clients = new ArrayList<>(); when(spyClientManager.getClients()).thenReturn(clients); String[] inputs = {"-t", "donations"}; CommandLine.run(spyPrintAllOrgan, System.out, inputs); MatcherAssert.assertThat(outContent.toString(), containsString("No clients exist")); }
@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();  }