### Question:
CompositeFilter implements Filter { @Override public Outcome accept(String ticker) { for (Filter filter : filters) { if (Outcome.ko.equals(filter.accept(ticker))) return Outcome.ko; } return Outcome.ok; } CompositeFilter(Filter[] filters); Filter[] getFilters(); @Override Outcome accept(String ticker);  }### Answer:
@Test public void positive() { CompositeFilter compositefilter = new CompositeFilter(new Filter[]{ filter1, filter2 }); context.checking(new Expectations() {{ oneOf(filter1).accept("GBX"); will(returnValue(Outcome.ok)); oneOf(filter2).accept("GBX"); will(returnValue(Outcome.ok)); }}); assertEquals(Outcome.ok, compositefilter.accept("GBX")); }
@Test public void negative_at_first_filter() { CompositeFilter compositefilter = new CompositeFilter(new Filter[]{ filter1, filter2 }); context.checking(new Expectations() {{ oneOf(filter1).accept("GBX"); will(returnValue(Outcome.ko)); }}); assertEquals(Outcome.ko, compositefilter.accept("GBX")); }
@Test public void negative_at_last_filter() { CompositeFilter compositefilter = new CompositeFilter(new Filter[]{ filter1, filter2 }); context.checking(new Expectations() {{ oneOf(filter1).accept("GBX"); will(returnValue(Outcome.ok)); oneOf(filter2).accept("GBX"); will(returnValue(Outcome.ko)); }}); assertEquals(Outcome.ko, compositefilter.accept("GBX")); }