@Test public void andExpressionsHasHigherPrecedenceThanOrExpression() { Condition condition = condition("header('Host') == 'bbc.co.uk' " + "AND header('Content-Length') == '7' " + "OR header('App-Name') =~ 'app[0-9]'"); LiveHttpRequest request = newRequest() .header("App-Name", "app5") .build(); assertThat(condition.evaluate(request, context), is(true)); request = newRequest() .header(HOST, "bbc.co.uk") .header(CONTENT_LENGTH, "7") .build(); assertThat(condition.evaluate(request, context), is(true)); request = newRequest() .header(HOST, "bbc.co.uk") .header(CONTENT_LENGTH, "8") .build(); assertThat(condition.evaluate(request, context), is(false)); request = newRequest() .header(HOST, "hotels.com") .header(CONTENT_LENGTH, "7") .header("App-Name", "appX") .build(); assertThat(condition.evaluate(request, 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);  }