### Question:
MarketCap implements Filter { @Override public Outcome accept(String ticker) { BigDecimal value = provider.getMarketCap(ticker); engine.put("value", value); try { Boolean result = (Boolean) engine.eval(expression); if (result == null) throw new IllegalArgumentException("expression \"" + expression + "\" should return a boolean result"); return result ? Outcome.ok : Outcome.ko; } catch (ScriptException e) { throw new RuntimeException( "Unable to evaluate expression \"" + expression + "\" with value " + value + " due to a " + e.getClass().getName() + " with message \"" + e.getMessage() + "\". Follows details:", e); } } MarketCap(MarketCap.Provider provider, String expression); String getExpression(); @Override Outcome accept(String ticker);  }### Answer:
@Test public void positive() { MarketCap marketcap = new MarketCap(provider, "value > 0"); context.checking(new Expectations() {{ oneOf(provider).getMarketCap("GBX"); will(returnValue(BigDecimal.ONE)); }}); assertEquals(Outcome.ok, marketcap.accept("GBX")); }
@Test public void negative() { MarketCap marketcap = new MarketCap(provider, "value < 0"); context.checking(new Expectations() {{ oneOf(provider).getMarketCap("GBX"); will(returnValue(BigDecimal.ONE)); }}); assertEquals(Outcome.ko, marketcap.accept("GBX")); }