@Test public void matchesAndExpressions() { Condition condition = condition("header('Host') == 'bbc.co.uk' AND header('Content-Length') == '7'"); LiveHttpRequest request = newRequest() .header(HOST, "bbc.co.uk") .header(CONTENT_LENGTH, "7") .build(); assertThat(condition.evaluate(request, context), is(true)); LiveHttpRequest request2 = newRequest() .header(HOST, "bbc.co.uk") .header(CONTENT_LENGTH, "1") .build(); assertThat(condition.evaluate(request2, context), is(false)); LiveHttpRequest request3 = newRequest() .header(HOST, "hotels.com") .header(CONTENT_LENGTH, "7") .build(); assertThat(condition.evaluate(request3, context), is(false)); LiveHttpRequest request4 = newRequest() .header(CONTENT_LENGTH, "7") .build(); assertThat(condition.evaluate(request4, context), is(false)); LiveHttpRequest request5 = newRequest() .header(HOST, "bbc.co.uk") .build(); assertThat(condition.evaluate(request5, 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);  }