sample/src/androidTest/java/com/urbanairship/sample/SampleTest.java
@Test
    public void testModalInAppMessageV2() throws Exception {

        // Create the modal in-app message
        ModalDisplayContent displayContent = ModalDisplayContent.newBuilder()
                                                                .setHeading(TextInfo.newBuilder()
                                                                                    .setText("Blue Heading aligned left")
                                                                                    .addFontFamily("arizonia")
                                                                                    .setAlignment(TextInfo.ALIGNMENT_LEFT)
                                                                                    .setColor(Color.BLUE)
                                                                                    .setFontSize(15)
                                                                                    .setDrawable(R.drawable.ic_menu_home)
                                                                                    .build())
                                                                .setBackgroundColor(Color.YELLOW)
                                                                .setBody(TextInfo.newBuilder()
                                                                                 .setText("What's in a name? that which we call a rose By any other name would smell as sweet; So Romeo would, were he not Romeo call'd, Retain that dear perfection which he owes Without that title. Romeo, doff thy name, And for that name which is no part of thee Take all myself.")
                                                                                 .setColor(Color.GREEN)
                                                                                 .addFontFamily("cursive")
                                                                                 .setFontSize(11)
                                                                                 .build())
                                                                .setMedia(MediaInfo.newBuilder()
                                                                                   .setUrl("https://media.giphy.com/media/JYsWwF82EGnpC/giphy.gif")
                                                                                   .setType(MediaInfo.TYPE_IMAGE)
                                                                                   .setDescription("mustache man")
                                                                                   .build())
                                                                .setBorderRadius(20)
                                                                .setDismissButtonColor(Color.MAGENTA)
                                                                .setFooter(ButtonInfo.newBuilder()
                                                                                     .setLabel(TextInfo.newBuilder()
                                                                                                       .setText("Footer is lukewarm.")
                                                                                                       .setColor(Color.RED)
                                                                                                       .addStyle(TextInfo.STYLE_UNDERLINE)
                                                                                                       .setAlignment(TextInfo.ALIGNMENT_RIGHT)
                                                                                                       .build())
                                                                                     .addAction("share_action", JsonValue.wrap("Sharing this awesome app!"))
                                                                                     .setId("footerId")
                                                                                     .build())
                                                                .setTemplate(ModalDisplayContent.TEMPLATE_HEADER_BODY_MEDIA)
                                                                .setButtonLayout(DisplayContent.BUTTON_LAYOUT_STACKED)
                                                                .addButton(ButtonInfo.newBuilder()
                                                                                     .setId("button-one")
                                                                                     .setBackgroundColor(Color.BLUE)
                                                                                     .setBorderRadius(2)
                                                                                     .setId("button id 1")
                                                                                     .setBehavior(ButtonInfo.BEHAVIOR_DISMISS)
                                                                                     .setBorderRadius(10)
                                                                                     .setBorderColor(Color.MAGENTA)
                                                                                     .setLabel(TextInfo.newBuilder()
                                                                                                       .setText("Modal One!")
                                                                                                       .setAlignment(TextInfo.ALIGNMENT_LEFT)
                                                                                                       .setColor(Color.WHITE)
                                                                                                       .build())
                                                                                     .addAction("add_tags_action", JsonValue.wrap("modal_one"))
                                                                                     .build())
                                                                .addButton(ButtonInfo.newBuilder()
                                                                                     .setBackgroundColor(Color.GRAY)
                                                                                     .setBorderRadius(2)
                                                                                     .setId("button-two")
                                                                                     .setLabel(TextInfo.newBuilder()
                                                                                                       .setText("Modal Two!")
                                                                                                       .setAlignment(TextInfo.ALIGNMENT_RIGHT)
                                                                                                       .setColor(Color.BLUE)
                                                                                                       .build())
                                                                                     .addAction("add_tags_action", JsonValue.wrap("modal_two"))
                                                                                     .build())
                                                                .build();

        // Schedule modal in-app message
        scheduleInAppMessageV2Modal(displayContent);

        // Wait for in-app message to be displayed
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));

        clickAndVerifyTagAdded("Modal One!", "modal_one");

        // Schedule modal in-app message
        scheduleInAppMessageV2Modal(displayContent);

        // Wait for in-app message to be displayed
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));

        clickAndVerifyTagAdded("Modal Two!", "modal_two");

    }
/**
     * Test a modal in-app message V2 with two buttons.
     */
Test a modal in-app message V2 with two buttons.
Test a modal in - app message V2 with two buttons .
@Test
    public void testModalInAppMessageV2() throws Exception {
        ModalDisplayContent displayContent = ModalDisplayContent.newBuilder()
                                                                .setHeading(TextInfo.newBuilder()
                                                                                    .setText("Blue Heading aligned left")
                                                                                    .addFontFamily("arizonia")
                                                                                    .setAlignment(TextInfo.ALIGNMENT_LEFT)
                                                                                    .setColor(Color.BLUE)
                                                                                    .setFontSize(15)
                                                                                    .setDrawable(R.drawable.ic_menu_home)
                                                                                    .build())
                                                                .setBackgroundColor(Color.YELLOW)
                                                                .setBody(TextInfo.newBuilder()
                                                                                 .setText("What's in a name? that which we call a rose By any other name would smell as sweet; So Romeo would, were he not Romeo call'd, Retain that dear perfection which he owes Without that title. Romeo, doff thy name, And for that name which is no part of thee Take all myself.")
                                                                                 .setColor(Color.GREEN)
                                                                                 .addFontFamily("cursive")
                                                                                 .setFontSize(11)
                                                                                 .build())
                                                                .setMedia(MediaInfo.newBuilder()
                                                                                   .setUrl("https://media.giphy.com/media/JYsWwF82EGnpC/giphy.gif")
                                                                                   .setType(MediaInfo.TYPE_IMAGE)
                                                                                   .setDescription("mustache man")
                                                                                   .build())
                                                                .setBorderRadius(20)
                                                                .setDismissButtonColor(Color.MAGENTA)
                                                                .setFooter(ButtonInfo.newBuilder()
                                                                                     .setLabel(TextInfo.newBuilder()
                                                                                                       .setText("Footer is lukewarm.")
                                                                                                       .setColor(Color.RED)
                                                                                                       .addStyle(TextInfo.STYLE_UNDERLINE)
                                                                                                       .setAlignment(TextInfo.ALIGNMENT_RIGHT)
                                                                                                       .build())
                                                                                     .addAction("share_action", JsonValue.wrap("Sharing this awesome app!"))
                                                                                     .setId("footerId")
                                                                                     .build())
                                                                .setTemplate(ModalDisplayContent.TEMPLATE_HEADER_BODY_MEDIA)
                                                                .setButtonLayout(DisplayContent.BUTTON_LAYOUT_STACKED)
                                                                .addButton(ButtonInfo.newBuilder()
                                                                                     .setId("button-one")
                                                                                     .setBackgroundColor(Color.BLUE)
                                                                                     .setBorderRadius(2)
                                                                                     .setId("button id 1")
                                                                                     .setBehavior(ButtonInfo.BEHAVIOR_DISMISS)
                                                                                     .setBorderRadius(10)
                                                                                     .setBorderColor(Color.MAGENTA)
                                                                                     .setLabel(TextInfo.newBuilder()
                                                                                                       .setText("Modal One!")
                                                                                                       .setAlignment(TextInfo.ALIGNMENT_LEFT)
                                                                                                       .setColor(Color.WHITE)
                                                                                                       .build())
                                                                                     .addAction("add_tags_action", JsonValue.wrap("modal_one"))
                                                                                     .build())
                                                                .addButton(ButtonInfo.newBuilder()
                                                                                     .setBackgroundColor(Color.GRAY)
                                                                                     .setBorderRadius(2)
                                                                                     .setId("button-two")
                                                                                     .setLabel(TextInfo.newBuilder()
                                                                                                       .setText("Modal Two!")
                                                                                                       .setAlignment(TextInfo.ALIGNMENT_RIGHT)
                                                                                                       .setColor(Color.BLUE)
                                                                                                       .build())
                                                                                     .addAction("add_tags_action", JsonValue.wrap("modal_two"))
                                                                                     .build())
                                                                .build();
        scheduleInAppMessageV2Modal(displayContent);
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));
        clickAndVerifyTagAdded("Modal One!", "modal_one");
        scheduleInAppMessageV2Modal(displayContent);
        Thread.sleep(TimeUnit.SECONDS.toMillis(1));
        clickAndVerifyTagAdded("Modal Two!", "modal_two");
    }
@ Test public void testModalInAppMessageV2 ( ) throws Exception { ModalDisplayContent displayContent = ModalDisplayContent . newBuilder ( ) . setHeading ( TextInfo . newBuilder ( ) . setText ( "Blue Heading aligned left" ) . addFontFamily ( "arizonia" ) . setAlignment ( TextInfo . ALIGNMENT_LEFT ) . setColor ( Color . BLUE ) . setFontSize ( 15 ) . setDrawable ( R . drawable . ic_menu_home ) . build ( ) ) . setBackgroundColor ( Color . YELLOW ) . setBody ( TextInfo . newBuilder ( ) . setText ( "What's in a name? that which we call a rose By any other name would smell as sweet; So Romeo would, were he not Romeo call'd, Retain that dear perfection which he owes Without that title. Romeo, doff thy name, And for that name which is no part of thee Take all myself." ) . setColor ( Color . GREEN ) . addFontFamily ( "cursive" ) . setFontSize ( 11 ) . build ( ) ) . setMedia ( MediaInfo . newBuilder ( ) . setUrl ( "https://media.giphy.com/media/JYsWwF82EGnpC/giphy.gif" ) . setType ( MediaInfo . TYPE_IMAGE ) . setDescription ( "mustache man" ) . build ( ) ) . setBorderRadius ( 20 ) . setDismissButtonColor ( Color . MAGENTA ) . setFooter ( ButtonInfo . newBuilder ( ) . setLabel ( TextInfo . newBuilder ( ) . setText ( "Footer is lukewarm." ) . setColor ( Color . RED ) . addStyle ( TextInfo . STYLE_UNDERLINE ) . setAlignment ( TextInfo . ALIGNMENT_RIGHT ) . build ( ) ) . addAction ( "share_action" , JsonValue . wrap ( "Sharing this awesome app!" ) ) . setId ( "footerId" ) . build ( ) ) . setTemplate ( ModalDisplayContent . TEMPLATE_HEADER_BODY_MEDIA ) . setButtonLayout ( DisplayContent . BUTTON_LAYOUT_STACKED ) . addButton ( ButtonInfo . newBuilder ( ) . setId ( "button-one" ) . setBackgroundColor ( Color . BLUE ) . setBorderRadius ( 2 ) . setId ( "button id 1" ) . setBehavior ( ButtonInfo . BEHAVIOR_DISMISS ) . setBorderRadius ( 10 ) . setBorderColor ( Color . MAGENTA ) . setLabel ( TextInfo . newBuilder ( ) . setText ( "Modal One!" ) . setAlignment ( TextInfo . ALIGNMENT_LEFT ) . setColor ( Color . WHITE ) . build ( ) ) . addAction ( "add_tags_action" , JsonValue . wrap ( "modal_one" ) ) . build ( ) ) . addButton ( ButtonInfo . newBuilder ( ) . setBackgroundColor ( Color . GRAY ) . setBorderRadius ( 2 ) . setId ( "button-two" ) . setLabel ( TextInfo . newBuilder ( ) . setText ( "Modal Two!" ) . setAlignment ( TextInfo . ALIGNMENT_RIGHT ) . setColor ( Color . BLUE ) . build ( ) ) . addAction ( "add_tags_action" , JsonValue . wrap ( "modal_two" ) ) . build ( ) ) . build ( ) ; scheduleInAppMessageV2Modal ( displayContent ) ; Thread . sleep ( TimeUnit . SECONDS . toMillis ( 1 ) ) ; clickAndVerifyTagAdded ( "Modal One!" , "modal_one" ) ; scheduleInAppMessageV2Modal ( displayContent ) ; Thread . sleep ( TimeUnit . SECONDS . toMillis ( 1 ) ) ; clickAndVerifyTagAdded ( "Modal Two!" , "modal_two" ) ; }
Test a modal in-app message V2 with two buttons.
Test a modal in - app message V2 with two buttons .
// Create the modal in-app message // Schedule modal in-app message // Wait for in-app message to be displayed // Schedule modal in-app message // Wait for in-app message to be displayed