urbanairship-core/src/test/java/com/urbanairship/richpush/RichPushMessageTest.java
@Test
    public void testMessage() throws JsonException {
        RichPushMessage message = RichPushMessage.create(JsonValue.parseString(MCRAP_MESSAGE), true, false);

        assertEquals("MESSAGE_ID", message.getMessageId());
        assertEquals("MESSAGE_TITLE", message.getTitle());
        assertEquals("https://dl.urbanairship.com/binary/token/app/MESSAGE_ID/body/", message.getMessageBodyUrl());
        assertEquals("https://device-api.urbanairship.com/api/user/test/messages/message/MESSAGE_ID/read/", message.getMessageReadUrl());
        assertEquals("https://device-api.urbanairship.com/api/user/test/messages/message/MESSAGE_ID/", message.getMessageUrl());
        assertEquals(1443026786000l, message.getSentDateMS());
        assertFalse(message.isRead());
        assertFalse(message.isDeleted());

        // Extras
        assertEquals(1, message.getExtras().size());
        assertEquals("some_value", message.getExtras().getString("some_key"));

        // Expiry
        assertNull(message.getExpirationDate());
        assertNull(message.getExpirationDateMS());
        assertFalse(message.isExpired());

        // Raw message JSON
        assertEquals(JsonValue.parseString(MCRAP_MESSAGE), message.getRawMessageJson());
    }
/**
     * Test message parses its data correctly.
     */
Test message parses its data correctly.
Test message parses its data correctly .
@Test
    public void testMessage() throws JsonException {
        RichPushMessage message = RichPushMessage.create(JsonValue.parseString(MCRAP_MESSAGE), true, false);
        assertEquals("MESSAGE_ID", message.getMessageId());
        assertEquals("MESSAGE_TITLE", message.getTitle());
        assertEquals("https://dl.urbanairship.com/binary/token/app/MESSAGE_ID/body/", message.getMessageBodyUrl());
        assertEquals("https://device-api.urbanairship.com/api/user/test/messages/message/MESSAGE_ID/read/", message.getMessageReadUrl());
        assertEquals("https://device-api.urbanairship.com/api/user/test/messages/message/MESSAGE_ID/", message.getMessageUrl());
        assertEquals(1443026786000l, message.getSentDateMS());
        assertFalse(message.isRead());
        assertFalse(message.isDeleted());
        assertEquals(1, message.getExtras().size());
        assertEquals("some_value", message.getExtras().getString("some_key"));
        assertNull(message.getExpirationDate());
        assertNull(message.getExpirationDateMS());
        assertFalse(message.isExpired());
        assertEquals(JsonValue.parseString(MCRAP_MESSAGE), message.getRawMessageJson());
    }
@ Test public void testMessage ( ) throws JsonException { RichPushMessage message = RichPushMessage . create ( JsonValue . parseString ( MCRAP_MESSAGE ) , true , false ) ; assertEquals ( "MESSAGE_ID" , message . getMessageId ( ) ) ; assertEquals ( "MESSAGE_TITLE" , message . getTitle ( ) ) ; assertEquals ( "https://dl.urbanairship.com/binary/token/app/MESSAGE_ID/body/" , message . getMessageBodyUrl ( ) ) ; assertEquals ( "https://device-api.urbanairship.com/api/user/test/messages/message/MESSAGE_ID/read/" , message . getMessageReadUrl ( ) ) ; assertEquals ( "https://device-api.urbanairship.com/api/user/test/messages/message/MESSAGE_ID/" , message . getMessageUrl ( ) ) ; assertEquals ( 1443026786000l , message . getSentDateMS ( ) ) ; assertFalse ( message . isRead ( ) ) ; assertFalse ( message . isDeleted ( ) ) ; assertEquals ( 1 , message . getExtras ( ) . size ( ) ) ; assertEquals ( "some_value" , message . getExtras ( ) . getString ( "some_key" ) ) ; assertNull ( message . getExpirationDate ( ) ) ; assertNull ( message . getExpirationDateMS ( ) ) ; assertFalse ( message . isExpired ( ) ) ; assertEquals ( JsonValue . parseString ( MCRAP_MESSAGE ) , message . getRawMessageJson ( ) ) ; }
Test message parses its data correctly.
Test message parses its data correctly .
// Extras // Expiry // Raw message JSON