diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2014-09-03 16:46:40 +0300 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-09-12 16:46:28 +0300 |
commit | 03097e75ccbbed2b434082f5cf939dec2a387bdf (patch) | |
tree | 1ae41aa04e60d3fcd7aa77be50d3245ef373d639 /server/tests/src/com/vaadin | |
parent | 0999abd4b3cd0628ab7f22aca765b7e06ca6eb69 (diff) | |
download | vaadin-framework-03097e75ccbbed2b434082f5cf939dec2a387bdf.tar.gz vaadin-framework-03097e75ccbbed2b434082f5cf939dec2a387bdf.zip |
Fix potential invalid JSON output in MetadataWriter (#14591)
Change-Id: I90ec428ae11727b9762d53ebb8d94f8c850c425b
Diffstat (limited to 'server/tests/src/com/vaadin')
-rw-r--r-- | server/tests/src/com/vaadin/server/communication/MetadataWriterTest.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/server/communication/MetadataWriterTest.java b/server/tests/src/com/vaadin/server/communication/MetadataWriterTest.java index dee37ddc7f..afae14007e 100644 --- a/server/tests/src/com/vaadin/server/communication/MetadataWriterTest.java +++ b/server/tests/src/com/vaadin/server/communication/MetadataWriterTest.java @@ -18,6 +18,7 @@ package com.vaadin.server.communication; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.io.IOException; import java.io.StringWriter; import org.junit.Assert; @@ -92,4 +93,17 @@ public class MetadataWriterTest { "{\"timedRedirect\":{\"interval\":15,\"url\":\"\"}}", writer .getBuffer().toString()); } + + @Test + public void writeAsyncWithSystemMessages() throws IOException { + WrappedSession wrappedSession = mock(WrappedSession.class); + when(session.getSession()).thenReturn(wrappedSession); + + disableSessionExpirationMessages(messages); + + new MetadataWriter().write(ui, writer, false, true, messages); + Assert.assertEquals( + "{\"async\":true,\"timedRedirect\":{\"interval\":15,\"url\":\"\"}}", + writer.getBuffer().toString()); + } } |