### Question:
ClientApplicationRestController { @GetMapping("{component}/instances") public Iterable getComponentInstances(@PathVariable("component") String component, @RequestParam("context") String context, Principal principal) { auditLog.info("[{}] Request for a list of clients belonging to component \"{}\" and context=\"{}\"", AuditLog.username(principal), component, context); return new ComponentItems<>(component, context, clients); } ClientApplicationRestController(Clients clients, ClientIdRegistry clientIdRegistry); @GetMapping("{component}/instances") Iterable getComponentInstances(@PathVariable("component") String component,
                                          @RequestParam("context") String context, Principal principal); @GetMapping("clients") Stream<Client> listClients(Principal principal); @GetMapping("clientIds") Printable listClientIds(Principal principal);  }### Answer:
@Test public void getComponentInstances() { Clients clients = () -> asList( (Client) new FakeClient("clientA",DEFAULT_CONTEXT, true), new FakeClient("clientB",DEFAULT_CONTEXT, false), new FakeClient("clientC",DEFAULT_CONTEXT, false)).iterator(); ClientApplicationRestController controller = new ClientApplicationRestController(clients, new DefaultClientIdRegistry()); Iterator iterator = controller.getComponentInstances("test", DEFAULT_CONTEXT, null).iterator(); assertTrue(iterator.hasNext()); iterator.next(); assertFalse(iterator.hasNext()); }