@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 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 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); }