### Question:
DoubleRegistry { public Collection<String> getRegisteredDoubleNames() { return Stream .concat( getMocks().stream(), getSpies().stream()) .map(DoubleDefinition::getName) .collect(Collectors.toSet()); } DoubleRegistry(Collection<DoubleDefinition> mocks, Collection<DoubleDefinition> spies); Collection<String> getRegisteredDoubleNames(); DoubleSearch spySearch(); DoubleSearch mockSearch(); DoubleSearch doublesSearch(); @Override boolean equals(Object o); @Override int hashCode(); static final String BEAN_NAME; }### Answer:
@Test public void should_return_all_registered_mock_names() { final String firstMockName = "firstService"; final String secondMockName = "secondService"; final String firstSpyName = "spy1"; final String secondSpyName = "spy2"; final DoubleRegistry registry = new DoubleRegistry( asList( doubleDefinition(Service.class, firstMockName), doubleDefinition(OtherService.class, secondMockName)), asList( doubleDefinition(Service.class, firstSpyName), doubleDefinition(Service.class, secondSpyName))); final Collection<String> mockNames = registry.getRegisteredDoubleNames(); assertEquals(4, mockNames.size()); assertThat(mockNames, containsInAnyOrder(firstMockName, secondMockName, firstSpyName, secondSpyName)); }