### Question:
CompositeNavigationMappingFilter implements NavigationMappingFilter { public boolean matches(NavigationContext context) { for (NavigationMappingFilter filter : this.filters) { if (!filter.matches(context)) { return false; } } return true; } CompositeNavigationMappingFilter(NavigationMappingFilter... filters); boolean matches(NavigationContext context);  }### Answer:
@Test public void shouldMatchIfAllMatch() throws Exception { NavigationMappingFilter f1 = mock(NavigationMappingFilter.class); NavigationMappingFilter f2 = mock(NavigationMappingFilter.class); NavigationMappingFilter f3 = mock(NavigationMappingFilter.class); given(f1.matches(this.context)).willReturn(true); given(f2.matches(this.context)).willReturn(true); given(f3.matches(this.context)).willReturn(true); CompositeNavigationMappingFilter composite = new CompositeNavigationMappingFilter(f1, f2, f3); assertThat(composite.matches(this.context), is(true)); }
@Test public void shouldNotMatchIfAnyDoesNotMatch() throws Exception { NavigationMappingFilter f1 = mock(NavigationMappingFilter.class); NavigationMappingFilter f2 = mock(NavigationMappingFilter.class); NavigationMappingFilter f3 = mock(NavigationMappingFilter.class); given(f1.matches(this.context)).willReturn(true); given(f2.matches(this.context)).willReturn(false); given(f3.matches(this.context)).willReturn(true); CompositeNavigationMappingFilter composite = new CompositeNavigationMappingFilter(f1, f2, f3); assertThat(composite.matches(this.context), is(false)); }