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