From 10e7a466bc936737b81005cb50d90c8bc8ca49bd Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 24 Jun 2015 23:28:22 +0300 Subject: Pass critical notification details to the client (#18342) Change-Id: I3c4eace624453eb854a32fef5fe44d253b164f62 --- .../src/com/vaadin/server/VaadinServiceTest.java | 45 +++++++++++----------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'server/tests') diff --git a/server/tests/src/com/vaadin/server/VaadinServiceTest.java b/server/tests/src/com/vaadin/server/VaadinServiceTest.java index 4b655e7855..bd3da6277a 100644 --- a/server/tests/src/com/vaadin/server/VaadinServiceTest.java +++ b/server/tests/src/com/vaadin/server/VaadinServiceTest.java @@ -42,9 +42,10 @@ public class VaadinServiceTest { } } - private String createCriticalNotification(String caption, String message, String details, String url) { - return VaadinService - .createCriticalNotificationJSON(caption, message, details, url); + private String createCriticalNotification(String caption, String message, + String details, String url) { + return VaadinService.createCriticalNotificationJSON(caption, message, + details, url); } @Test @@ -77,64 +78,64 @@ public class VaadinServiceTest { @Test public void captionIsSetToACriticalNotification() { - String notification = - createCriticalNotification("foobar", "message", "details", "url"); + String notification = createCriticalNotification("foobar", "message", + "details", "url"); assertThat(notification, containsString("\"caption\":\"foobar\"")); } @Test public void nullCaptionIsSetToACriticalNotification() { - String notification = - createCriticalNotification(null, "message", "details", "url"); + String notification = createCriticalNotification(null, "message", + "details", "url"); assertThat(notification, containsString("\"caption\":null")); } @Test public void messageWithDetailsIsSetToACriticalNotification() { - String notification = - createCriticalNotification("caption", "foo", "bar", "url"); + String notification = createCriticalNotification("caption", "foo", + "bar", "url"); - assertThat(notification, containsString("\"message\":\"foo

bar\"")); + assertThat(notification, containsString("\"details\":\"bar\"")); } @Test - public void nullMessageIsReplacedByDetailsInACriticalNotification() { - String notification = - createCriticalNotification("caption", null, "foobar", "url"); + public void nullMessageSentAsNullInACriticalNotification() { + String notification = createCriticalNotification("caption", null, + "foobar", "url"); - assertThat(notification, containsString("\"message\":\"foobar\"")); + assertThat(notification, containsString("\"message\":null")); } @Test public void nullMessageIsSetToACriticalNotification() { - String notification = - createCriticalNotification("caption", null, null, "url"); + String notification = createCriticalNotification("caption", null, null, + "url"); assertThat(notification, containsString("\"message\":null")); } @Test public void messageSetToACriticalNotification() { - String notification = - createCriticalNotification("caption", "foobar", null, "url"); + String notification = createCriticalNotification("caption", "foobar", + null, "url"); assertThat(notification, containsString("\"message\":\"foobar\"")); } @Test public void urlIsSetToACriticalNotification() { - String notification = - createCriticalNotification("caption", "message", "details", "foobar"); + String notification = createCriticalNotification("caption", "message", + "details", "foobar"); assertThat(notification, containsString("\"url\":\"foobar\"")); } @Test public void nullUrlIsSetToACriticalNotification() { - String notification = - createCriticalNotification("caption", "message", "details", null); + String notification = createCriticalNotification("caption", "message", + "details", null); assertThat(notification, containsString("\"url\":null")); } -- cgit v1.2.3