@Test
  public void testGetCurrentReturnsStandardByDefault() {
    StringWriter standard = new StringWriter();
    RenderContext renderContext = new RenderContextImpl(standard, null);

    Appendable actual = renderContext.getCurrent();
    assertSame(standard, actual);
  }
  @Test
  public void testPushScriptSwithCurrentToScript() {
    StringWriter script = new StringWriter();
    RenderContext renderContext = new RenderContextImpl(null, script);

    renderContext.pushScript();

    Appendable actual = renderContext.getCurrent();
    assertSame(script, actual);
  }
  @Test
  public void testGetScriptReturnsScriptContentWhenCurrentIsStandard() {
    String expected = "script content";
    StringWriter script = new StringWriter();
    script.append(expected);
    // current is standard by default
    RenderContext renderContext = new RenderContextImpl(null, script);

    String actual = renderContext.getScript();
    assertEquals(expected, actual);
  }
  @Test
  public void testGetStandardRetunsStandardContent() throws Exception {
    String expected = "standard content";
    StringWriter standard = new StringWriter();
    RenderContext renderContext = new RenderContextImpl(standard, null);

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

    String actual = renderContext.getStandard();
    assertEquals(expected, actual);
  }
  @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);
  }
  @Test
  public void testExceptionIsThrownWhenPopScriptMoreThanPush() {
    StringWriter script = new StringWriter();
    RenderContext renderContext = new RenderContextImpl(null, script);

    try {
      renderContext.popScript();
    } catch (Exception e) {
      String expectedMessage = "Script popped too many times";
      this.checkExceptionFull(e, RuntimeException.class, expectedMessage);
    }
  }
  @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);
  }
 @Test
 public void testGetStandardWhenStandardIsNull() throws Exception {
   RenderContext renderContext = new RenderContextImpl(null, null);
   String actual = renderContext.getStandard();
   assertNull(actual);
 }