### Question:
MultisourceBeanLocator implements ConfiguredBeanLocator { @Override public boolean hasBeanOfName(String name) { return locators.stream() .map(locator -> locator.hasBeanOfName(name)) .filter(Boolean::booleanValue) .findFirst().orElse(false); } MultisourceBeanLocator(ConfiguredBeanLocator... locators); @Override List<String> getBeanNamesOfType(Class<?> type); @Override T getBeanOfType(String name, Class<T> type); @Override Collection<? extends T> getBeansOfType(Class<T> type); @Override boolean loadBeansOfType(Class<T> type, BeanLoaderListener<T> listener); @Override boolean hasConfiguredPropertyValue(String beanName, String propertyName, String value); @Override boolean hasBeanOfName(String name);  }### Answer:
@Test public void testHasBeanOfName_firstLocator() { when(source1.hasBeanOfName(eq("test"))).thenReturn(true); when(source2.hasBeanOfName(eq("test"))).thenReturn(false); verifyNoMoreInteractions(source2); Assert.assertTrue(multisourceBeanLocator.hasBeanOfName("test")); }
@Test public void testHasBeanOfName_secondLocator() { when(source1.hasBeanOfName(eq("test"))).thenReturn(false); when(source2.hasBeanOfName(eq("test"))).thenReturn(true); Assert.assertTrue(multisourceBeanLocator.hasBeanOfName("test")); }
@Test public void testHasBeanOfName_noLocator() { when(source1.hasBeanOfName(eq("test"))).thenReturn(false); when(source2.hasBeanOfName(eq("test"))).thenReturn(false); Assert.assertFalse(multisourceBeanLocator.hasBeanOfName("test")); }