urbanairship-core/src/test/java/com/urbanairship/actions/ActionServiceTest.java
@Test
    public void testRunActionsWithString() {
        ShadowApplication shadowApplication = Shadows.shadowOf(RuntimeEnvironment.application);
        shadowApplication.clearStartedServices();

        String actionsPayload = "{ \"actionName\": \"actionValue\" }";

        Bundle metadata = new Bundle();
        metadata.putString("oh", "hi");

        ActionService.runActions(context, actionsPayload, Action.SITUATION_WEB_VIEW_INVOCATION, metadata);

        Intent runActionsIntent = shadowApplication.getNextStartedService();
        assertNotNull(runActionsIntent);

        assertEquals("Should add an intent with action RUN_ACTIONS_ACTION",
                runActionsIntent.getAction(), ActionService.ACTION_RUN_ACTIONS);

        Bundle actionBundle = runActionsIntent.getBundleExtra(ActionService.EXTRA_ACTIONS_BUNDLE);
        assertEquals(actionBundle.getParcelable("actionName"), ActionValue.wrap("actionValue"));

        assertEquals("Should add the situation", Action.SITUATION_WEB_VIEW_INVOCATION,
                runActionsIntent.getSerializableExtra(ActionService.EXTRA_SITUATION));
    }
/**
     * Test that the ActionService.runActions starts the
     * action service with the correct intent.
     */
Test that the ActionService.runActions starts the
action service with the correct intent.
Test that the ActionService . runActions starts the action service with the correct intent .
@Test
    public void testRunActionsWithString() {
        ShadowApplication shadowApplication = Shadows.shadowOf(RuntimeEnvironment.application);
        shadowApplication.clearStartedServices();
        String actionsPayload = "{ \"actionName\": \"actionValue\" }";
        Bundle metadata = new Bundle();
        metadata.putString("oh", "hi");
        ActionService.runActions(context, actionsPayload, Action.SITUATION_WEB_VIEW_INVOCATION, metadata);
        Intent runActionsIntent = shadowApplication.getNextStartedService();
        assertNotNull(runActionsIntent);
        assertEquals("Should add an intent with action RUN_ACTIONS_ACTION",
                runActionsIntent.getAction(), ActionService.ACTION_RUN_ACTIONS);
        Bundle actionBundle = runActionsIntent.getBundleExtra(ActionService.EXTRA_ACTIONS_BUNDLE);
        assertEquals(actionBundle.getParcelable("actionName"), ActionValue.wrap("actionValue"));
        assertEquals("Should add the situation", Action.SITUATION_WEB_VIEW_INVOCATION,
                runActionsIntent.getSerializableExtra(ActionService.EXTRA_SITUATION));
    }
@ Test public void testRunActionsWithString ( ) { ShadowApplication shadowApplication = Shadows . shadowOf ( RuntimeEnvironment . application ) ; shadowApplication . clearStartedServices ( ) ; String actionsPayload = "{ \"actionName\": \"actionValue\" }" ; Bundle metadata = new Bundle ( ) ; metadata . putString ( "oh" , "hi" ) ; ActionService . runActions ( context , actionsPayload , Action . SITUATION_WEB_VIEW_INVOCATION , metadata ) ; Intent runActionsIntent = shadowApplication . getNextStartedService ( ) ; assertNotNull ( runActionsIntent ) ; assertEquals ( "Should add an intent with action RUN_ACTIONS_ACTION" , runActionsIntent . getAction ( ) , ActionService . ACTION_RUN_ACTIONS ) ; Bundle actionBundle = runActionsIntent . getBundleExtra ( ActionService . EXTRA_ACTIONS_BUNDLE ) ; assertEquals ( actionBundle . getParcelable ( "actionName" ) , ActionValue . wrap ( "actionValue" ) ) ; assertEquals ( "Should add the situation" , Action . SITUATION_WEB_VIEW_INVOCATION , runActionsIntent . getSerializableExtra ( ActionService . EXTRA_SITUATION ) ) ; }
Test that the ActionService.runActions starts the
 action service with the correct intent.
Test that the ActionService . runActions starts the action service with the correct intent .