Package com.google.sitebricks

Examples of com.google.sitebricks.Respond


    //tell pagebook to track this as an embedded widget
    pageBook.embedAs(MyEmbeddedPage.class, MyEmbeddedPage.MY_FAVE_ANNOTATION)
        .apply(Chains.terminal());

    final Respond mockRespond = RespondersForTesting.newRespond();
    widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);
    final String s = mockRespond.toString();
    assert "<xml><div class=\"content\">hello </div></xml>"
        .equals(s) : "Did not write expected output, instead: " + s;
  }
View Full Code Here


    //tell pagebook to track this as an embedded widget
    pageBook.embedAs(MyEmbeddedPage.class, MyEmbeddedPage.MY_FAVE_ANNOTATION)
        .apply(Chains.terminal());

    final Respond mockRespond = RespondersForTesting.newRespond();

    widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);

    final String s = mockRespond.toString();
    assert "<html><div class=\"content\">hello </div></html>"
        .equals(s) : "Did not write expected output, instead: " + s;
  }
View Full Code Here

          .compile(Object.class, template("<html><#if true><p>hello</p></#if></html>"));

    assert null != widget : " null ";

    final StringBuilder builder = new StringBuilder();
    final Respond mockRespond = RespondersForTesting.newRespond();
    widget.render(new Object(), mockRespond);
    final String value = mockRespond.toString();
    System.out.println(value);
    assert "<html><p>hello</p></html>".equals(value) : "Did not write expected output, instead: " + value;
  }
View Full Code Here

    assert null != widget : " null ";

    final StringBuilder builder = new StringBuilder();

    final Respond mockRespond = RespondersForTesting.newRespond();

    widget.render(new Object(), mockRespond);

    final String value = mockRespond.toString();
    System.out.println(value);
    assert "<html><p>hello</p></html>".equals(value) : "Did not write expected output, instead: " + value;
  }
View Full Code Here

    assert null != widget : " null ";

    final StringBuilder builder = new StringBuilder();

    final Respond mockRespond = RespondersForTesting.newRespond();
    widget.render(new Object(), mockRespond);

    final String value = mockRespond.toString();
    assert "<html></html>".equals(value) : "Did not write expected output, instead: " + value;
  }
View Full Code Here

            .compile(Object.class, template("<html><div class='${clazz}'>hello <a href='/people/${id}'>${name}</a></div></html>"));

    assert null != widget : " null ";


    final Respond mockRespond = RespondersForTesting.newRespond();

    widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);

    final String value = mockRespond.toString();
    assert "<html><div class='content'>hello <a href='/people/12'>Dhanji</a></div></html>"
        .replace("\"", "'")
        .equals(value) : "Did not write expected output, instead: " + value;
  }
View Full Code Here

            .compile(Object.class, template("<html><div class='${clazz}'>hello</div></html>"));

    assert null != widget : " null ";


    final Respond mockRespond = RespondersForTesting.newRespond();

    widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);

    final String s = mockRespond.toString();
    assert "<html><div class=\"content\">hello</div></html>"
        .replace( "\"", "'")               
        .equals(s) : "Did not write expected output, instead: " + s;
  }
View Full Code Here

            .compile(Object.class, template("<!doctype html><html><body><div class='${clazz}'>hello <#if false><a href='/hi/${id}'>hideme</a></#if></div></body></html>"));

    assert null != widget : " null ";


    final Respond mockRespond = RespondersForTesting.newRespond();

    widget.render(new TestBackingType("Dhanji", "content", 12), mockRespond);

    final String s = mockRespond.toString();
    assertEquals(s, "<!doctype html><html><body><div class=\"content\">hello </div></body></html>".replace("\"", "'"));
  }
View Full Code Here

    }

    @Test(dataProvider = NAME_VALUES)
    public final void renderATemplateWithObject(final String name) throws ExpressionCompileException {
        final String[] out = new String[1];
        Respond respond = createMock(Respond.class);
        respond.write("Hello " + name);


        replay(respond);

        new TextWidget("Hello ${name}", new MvelEvaluatorCompiler(ATestType.class))
View Full Code Here

    }

    @Test(dataProvider = MVEL_NAMES)
    public final void renderATemplateWithObjectGraph(final TestBackingType data, String name) throws ExpressionCompileException {
        final String[] out = new String[1];
        Respond respond = createMock(Respond.class);

        respond.write("Hello " + name);

        replay(respond);

        new TextWidget("Hello ${names.first}", new MvelEvaluatorCompiler(TestBackingType.class))
                .render(data, respond);
View Full Code Here

TOP

Related Classes of com.google.sitebricks.Respond

Copyright © 2018 www.massapicom. 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.