Package com.google.sitebricks

Examples of com.google.sitebricks.Evaluator.evaluate()


        final WidgetChain mockChain = new ProceedingWidgetChain() {
            @Override
            public void render(final Object bound, Respond respond) {
                times[0]++;

                final Object thing = evaluator.evaluate(exp, bound);
                assert thing instanceof Thing : "Contextual (current) var not set: " + thing;
                assert A_NAME.equals(((Thing)thing).getName());
            }
        };
View Full Code Here


    public final void compileEvaluatorFromExpression() throws ExpressionCompileException {
        Evaluator compiled = new MvelEvaluatorCompiler(AType.class)
                                    .compile("name");

        //reading expression
        Object value = compiled.evaluate(null, new AType(A_NAME));

        assert A_NAME == value;
    }

    @Test
View Full Code Here

    public final void compileExpressionInvokingArbitraryMethod() throws ExpressionCompileException {
        Evaluator compiled = new MvelEvaluatorCompiler(AType.class)
                                    .compile("b.sigmatron('Hi')");

        //reading expression
        assert "Hi".equals(compiled.evaluate(null, new AType(A_NAME)));

    }

    @Test
    public final void compileExpressionInvokingArbitraryMethodAndTestReturn() throws ExpressionCompileException {
View Full Code Here

    public final void compileExpressionInvokingArbitraryMethodAndTestReturn() throws ExpressionCompileException {
        Evaluator compiled = new MvelEvaluatorCompiler(AType.class)
                                    .compile("b.sigmatron(null)");

        //reading expression
        assert null == (compiled.evaluate(null, new AType(A_NAME)));

    }

    @Test(expectedExceptions = ExpressionCompileException.class)
    public final void failCompileExpressionInvokingArbitraryMethodThruInterface() throws ExpressionCompileException {
View Full Code Here

    public final void failCompileExpressionInvokingArbitraryMethodThruInterface() throws ExpressionCompileException {
        Evaluator compiled = new MvelEvaluatorCompiler(AType.class)
                                    .compile("b.bkind.sigmatron(null)");

        //reading expression
        assert null == (compiled.evaluate(null, new AType(A_NAME)));

    }

    @Test
    public final void compileExpressionInvokingArbitraryMethodThruInterface() throws ExpressionCompileException {
View Full Code Here

        Evaluator compiled = new MvelEvaluatorCompiler(AType.class)
                                    .compile("bkind.getDubdub()");

        //reading expression
        final AType anA = new AType(A_NAME);
        assert anA.getB().getDubdub().equals(compiled.evaluate(null, anA));

    }

    @Test
    public final void compileExpressionInvokingArbitraryMethodThruInterfaceAndRegular() throws ExpressionCompileException {
View Full Code Here

        Evaluator compiled = new MvelEvaluatorCompiler(AType.class)
                                    .compile("bkind.getDubdub() == b.dubdub");

        //reading expression
        //noinspection ConstantConditions
        assert (Boolean)compiled.evaluate(null, new AType(A_NAME));

    }

    @Test(expectedExceptions = ExpressionCompileException.class)
    public final void failCompileExpressionInvokingArbitraryMethodWithWrongArgs() throws ExpressionCompileException {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.