### Question:
Registry { public void enrolAll(Registry source) { candidates.putAll(source.getCandidatesView()); }  Registry withCandidate(String resource, UUID candidate); void enrolAll(Registry source); void enrol(String resource, UUID candidate); void unenrol(String resource, UUID candidate); Set<String> getResourcesView(); Map<String, Set<UUID>> getCandidatesView(); @Override String toString();  }### Answer:
@Test public void testEnrolAll() { final UUID c = UUID.randomUUID(); final Registry source = new Registry().withCandidate("resource", c); final Registry r = new Registry(); r.enrolAll(source); assertEquals(Collections.singleton(c), r.getCandidatesView().get("resource")); assertEquals(1, r.getCandidatesView().size()); assertEquals(Collections.singleton("resource"), r.getResourcesView()); }