}
JsonObject appError = Json.createObject();
- appError.put("caption", caption);
- appError.put("message", message);
+ if (caption == null) {
+ appError.put("caption", Json.createNull());
+ } else {
+ appError.put("caption", caption);
+ }
+
+ if (message == null) {
+ appError.put("message", Json.createNull());
+ } else {
+ appError.put("message", message);
+ }
+
if (url == null) {
appError.put("url", Json.createNull());
} else {
Assert.assertEquals("SessionDestroyListeners not called exactly once",
1, listener.callCount);
}
+
+ @Test
+ public void testCriticalNotificationNullHandling() {
+ for (String caption : new String[] { "some caption", null }) {
+ for (String message : new String[] { "some message", null }) {
+ for (String details : new String[] { "some details", null }) {
+ for (String url : new String[] { "some url", null }) {
+ VaadinService.createCriticalNotificationJSON(caption,
+ message, details, url);
+ }
+ }
+ }
+ }
+ }
}