@Test public void parenthesisChangesOperatorPrecedence() { Condition condition = condition("header('Host') " + "AND (header('App-Name') =~ 'app[0-9]' OR header('App-Name') =~ 'shop[0-9]')"); LiveHttpRequest request1 = newRequest() .header(HOST, "bbc.co.uk") .header("App-Name", "app1") .build(); assertThat(condition.evaluate(request1, context), is(true)); LiveHttpRequest request2 = newRequest() .header(HOST, "bbc.co.uk") .header("App-Name", "shop2") .build(); assertThat(condition.evaluate(request2, context), is(true)); LiveHttpRequest request3 = newRequest() .header(HOST, "bbc.co.uk") .header("App-Name", "landing3") .build(); assertThat(condition.evaluate(request3, context), is(false)); }
@Override public boolean evaluate(LiveHttpRequest request, HttpInterceptor.Context context) { return expression.evaluate(request, context); }
AntlrCondition implements Condition { @Override public boolean evaluate(LiveHttpRequest request, HttpInterceptor.Context context) { return expression.evaluate(request, context); } }
AntlrCondition implements Condition { @Override public boolean evaluate(LiveHttpRequest request, HttpInterceptor.Context context) { return expression.evaluate(request, context); } AntlrCondition(Expression<Boolean> expression); }
AntlrCondition implements Condition { @Override public boolean evaluate(LiveHttpRequest request, HttpInterceptor.Context context) { return expression.evaluate(request, context); } AntlrCondition(Expression<Boolean> expression); @Override boolean evaluate(LiveHttpRequest request, HttpInterceptor.Context context); }
AntlrCondition implements Condition { @Override public boolean evaluate(LiveHttpRequest request, HttpInterceptor.Context context) { return expression.evaluate(request, context); } AntlrCondition(Expression<Boolean> expression); @Override boolean evaluate(LiveHttpRequest request, HttpInterceptor.Context context);  }