### Question:
PrintAllInfo implements Runnable { @Override public void run() { List<Client> clients = manager.getClients(); if (clients.isEmpty()) { outputStream.println("No clients exist"); } else { for (Client client : clients) { outputStream.println(client.getClientInfoString()); } } } PrintAllInfo();  PrintAllInfo(PrintStream outputStream);  PrintAllInfo(ClientManager manager); @Override void run();  }### Answer:
@Test public void printallinfo_no_clients() { ArrayList<Client> clients = new ArrayList<>(); when(spyClientManager.getClients()).thenReturn(clients); String[] inputs = {}; CommandLine.run(spyPrintAllInfo, System.out, inputs); assertThat(outContent.toString(), containsString("No clients exist")); }
@Test public void printallinfo_single_client() { Client client = new Client("First", "mid", "Last", LocalDate.of(1970, 1, 1), 1); ArrayList<Client> clients = new ArrayList<>(); clients.add(client); when(spyClientManager.getClients()).thenReturn(clients); String[] inputs = {}; CommandLine.run(spyPrintAllInfo, System.out, inputs); assertThat(outContent.toString(), containsString("User: 1. Name: First mid Last, date of birth: 1970-01-01, date of death: null")); }
@Test public void printallinfo_multiple_clients() { Client client = new Client("First", "mid", "Last", LocalDate.of(1970, 1, 1), 1); Client client2 = new Client("FirstTwo", null, "LastTwo", LocalDate.of(1971, 2, 2), 2); ArrayList<Client> clients = new ArrayList<>(); clients.add(client); clients.add(client2); when(spyClientManager.getClients()).thenReturn(clients); String[] inputs = {}; CommandLine.run(spyPrintAllInfo, System.out, inputs); assertThat(outContent.toString(), containsString("User: 1. Name: First mid Last, date of birth: 1970-01-01, date of death: null")); assertThat(outContent.toString(), containsString("User: 2. Name: FirstTwo LastTwo, date of birth: 1971-02-02, date of death: null")); }