### Question:
SnsPushMessageConverter implements PushMessageConverter { @Override public String toTransferFormat(PushMessage message) { JsonValue gcm = json(object( field(GCM_PRIORITY, GCM_HIGH_PRIORITY), field(GCM_DATA, object( field(GCM_MESSAGE, message.getBody()), field(MESSAGE_ID, message.getMessageId()))))); JsonValue apple = json(object( field(APNS_APS, object( field(APNS_ALERT, message.getSubject()), field(APNS_SOUND, APNS_DEFAULT_SOUND), field(MESSAGE_ID, message.getMessageId()), field(APNS_DATA, message.getBody()), field(APNS_CONTENT_AVAILABLE, APNS_CONTENT_AVAILABLE_TRUE))))); JsonValue toSend = json(object( field(DEFAULT, message.getSubject()), field(GCM, gcm.toString()), field(APNS, apple.toString()), field(APNS_SANDBOX, apple.toString()) )); return toSend.toString(); }  @Override String toTransferFormat(PushMessage message);  }### Answer:
@Test public void shouldConvertToFormat() { PushMessage pm = new PushMessage("recipient", "body", "subject", "messageId"); String result = converter.toTransferFormat(pm); JsonValue value = JsonValueBuilder.toJsonValue(result); assertThat(value.get("default")).isString().contains("subject"); assertThat(value.get("GCM")).isString(); JsonValue gcmValue = JsonValueBuilder.toJsonValue(value.get("GCM").asString()); assertThat(gcmValue.get("PRIORITY")).isString().isEqualTo("high"); assertThat(gcmValue.get("data")).isNotNull(); JsonValue gcmDataValue = gcmValue.get("data"); assertThat(gcmDataValue.get("messageId")).isString().isEqualTo("messageId"); assertThat(gcmDataValue.get("message")).isString().isEqualTo("body"); assertThat(value.get("APNS")).isString(); JsonValue apnsValue = JsonValueBuilder.toJsonValue(value.get("APNS").asString()); assertThat(apnsValue.get("aps")).isNotNull(); JsonValue apnsDataValue = apnsValue.get("aps"); assertThat(apnsDataValue.get("messageId")).isString().isEqualTo("messageId"); assertThat(apnsDataValue.get("alert")).isString().isEqualTo("subject"); assertThat(apnsDataValue.get("data")).isString().isEqualTo("body"); assertThat(apnsDataValue.get("sound")).isString().isEqualTo("default"); }