@Test public void getAll() { Snitch snitch1 = Mockito.mock(Snitch.class); Mockito.when(snitch1.getUri()).thenReturn(URI.create("fake: Snitch snitch2 = Mockito.mock(Snitch.class); Mockito.when(snitch2.getUri()).thenReturn(URI.create("fake: Snitch snitchDuplicate2 = Mockito.mock(Snitch.class); Mockito.when(snitchDuplicate2.getUri()).thenReturn(URI.create("fake: SnitchRegistry registry = StaticSnitchRegistry.of(snitch1, snitch2); List<Snitch> actual = registry.getAll(); List<Snitch> expected = new ArrayList<>(Arrays.asList(snitch1, snitch2)); Assert.assertEquals(expected, actual); }
@Override public List<Snitch> getAll() { return new ArrayList<>(registry); }
StaticSnitchRegistry implements SnitchRegistry { @Override public List<Snitch> getAll() { return new ArrayList<>(registry); } }
StaticSnitchRegistry implements SnitchRegistry { @Override public List<Snitch> getAll() { return new ArrayList<>(registry); } StaticSnitchRegistry(Snitch... snitches);  StaticSnitchRegistry(Collection<Snitch> snitches); }
StaticSnitchRegistry implements SnitchRegistry { @Override public List<Snitch> getAll() { return new ArrayList<>(registry); } StaticSnitchRegistry(Snitch... snitches);  StaticSnitchRegistry(Collection<Snitch> snitches); static SnitchRegistry of(Snitch... snitches); static SnitchRegistry of(Collection<Snitch> snitches); static List<Snitch> filterDuplicateLocations(Collection<Snitch> snitches); @Override List<Snitch> getAll(); }
StaticSnitchRegistry implements SnitchRegistry { @Override public List<Snitch> getAll() { return new ArrayList<>(registry); } StaticSnitchRegistry(Snitch... snitches);  StaticSnitchRegistry(Collection<Snitch> snitches); static SnitchRegistry of(Snitch... snitches); static SnitchRegistry of(Collection<Snitch> snitches); static List<Snitch> filterDuplicateLocations(Collection<Snitch> snitches); @Override List<Snitch> getAll();  }