### Question:
CompositeResolver implements Resolver { @Override public String resolve() { String result = null; for (Resolver resolver : resolvers) { result = resolver.resolve(); if (result != null) { break; } } return result; } CompositeResolver(List<Resolver> resolvers); @Override String resolve();  }### Answer:
@Test public void shouldLocateLocationA() throws Exception { when(resolverA.resolve()).thenReturn(LOCATION_A); assertThat(compositeLocator.resolve()).isEqualTo(LOCATION_A); verifyNoMoreInteractions(resolverB); }
@Test public void shouldLocateLocationB() throws Exception { when(resolverB.resolve()).thenReturn(LOCATION_B); assertThat(compositeLocator.resolve()).isEqualTo(LOCATION_B); verify(resolverA).resolve(); }
@Test public void shouldNotLocateAnything() throws Exception { assertThat(compositeLocator.resolve()).isNull(); verify(resolverA).resolve(); verify(resolverB).resolve(); }