public FilterValidator isParameterText(final int parameterIndex, final String parameterText) throws ExpressionVisitException, ODataApplicationException { if (curExpression instanceof MethodImpl) { MethodImpl methodCall = (MethodImpl) curExpression; Expression parameter = methodCall.getParameters().get(parameterIndex); String actualParameterText = FilterTreeToText.Serialize(parameter); assertEquals(parameterText, actualParameterText); } else if (curExpression instanceof MemberImpl) { final MemberImpl member = (MemberImpl) curExpression; final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); if (!uriResourceParts.isEmpty() && uriResourceParts.get(0) instanceof UriResourceFunctionImpl) { assertEquals( parameterText, ((UriResourceFunctionImpl) uriResourceParts.get(0)) .getParameters() .get(parameterIndex) .getText()); } else { fail("Current expression is not a method or function"); } } else { fail("Current expression is not a method or function"); } return this; }
public FilterValidator goParameter(final int parameterIndex) { if (curExpression instanceof MethodImpl) { MethodImpl methodCall = (MethodImpl) curExpression; curExpression = methodCall.getParameters().get(parameterIndex); } else { fail("Current expression not a methodCall"); } return this; }
public FilterValidator isMethod(final MethodKind methodKind, final int parameterCount) { if (!(curExpression instanceof MethodImpl)) { fail("Current expression is not a methodCall"); } MethodImpl methodCall = (MethodImpl) curExpression; assertEquals(methodKind, methodCall.getMethod()); assertEquals(parameterCount, methodCall.getParameters().size()); return this; }
public FilterValidator isParameterText(final int parameterIndex, final String parameterText) throws ExpressionVisitException, ODataApplicationException { if (!(curExpression instanceof MethodImpl)) { fail("Current expression is not a method"); } MethodImpl methodCall = (MethodImpl) curExpression; Expression parameter = methodCall.getParameters().get(parameterIndex); String actualParameterText = FilterTreeToText.Serialize(parameter); assertEquals(parameterText, actualParameterText); return this; }