Esempio n. 1
0
  @Test
  public void testPushScriptSwithCurrentToScript() {
    StringWriter script = new StringWriter();
    RenderContext renderContext = new RenderContextImpl(null, script);

    renderContext.pushScript();

    Appendable actual = renderContext.getCurrent();
    assertSame(script, actual);
  }
Esempio n. 2
0
  @Test
  public void testPopScriptSwitchCurrentToStandard() {
    StringWriter standard = new StringWriter();
    StringWriter script = new StringWriter();
    RenderContext renderContext = new RenderContextImpl(standard, script);
    renderContext.pushScript();

    renderContext.popScript();

    Appendable actual = renderContext.getCurrent();
    assertSame(standard, actual);
  }
Esempio n. 3
0
  @Test
  public void testGetScriptReturnsScriptContent() throws Exception {
    String expected = "script content";
    StringWriter script = new StringWriter();
    RenderContext renderContext = new RenderContextImpl(null, script);

    renderContext.pushScript();
    Appendable current = renderContext.getCurrent();
    current.append(expected);

    String actual = renderContext.getScript();
    assertEquals(expected, actual);
  }