@Test public void testEmptyAlert() throws Exception { IOSDevicePayload payload = IOSDevicePayload.newBuilder() .setAlert(IOSAlertData.newBuilder().build()) .setBadge( IOSBadgeData.newBuilder().setType(IOSBadgeData.Type.VALUE).setValue(1).build()) .build(); String json = mapper.writeValueAsString(payload); String expected = "{\"badge\":1}"; assertEquals(expected, json); }
@Test public void testCompoundAlert() throws Exception { IOSDevicePayload payload = IOSDevicePayload.newBuilder() .setAlert( IOSAlertData.newBuilder() .setBody("B") .setActionLocKey("ALK") .setLocKey("LK") .setLocArgs(ImmutableList.of("arg1", "arg2")) .setLaunchImage("LI") .build()) .build(); String json = mapper.writeValueAsString(payload); String expected = "{\"alert\":\"B\"}"; assertEquals(expected, json); }