urbanairship-core/src/test/java/com/urbanairship/actions/ActionRegistryTest.java
@Test
    public void testEntryActionForSituation() {
        Action defaultAction = new TestAction();
        Action openAction = new TestAction();
        Action receiveAction = new TestAction();

        registry.registerAction(defaultAction, "action");

        ActionRegistry.Entry entry = registry.registerAction(defaultAction, "action");
        entry.addSituationOverride(openAction, Action.SITUATION_PUSH_OPENED);
        entry.addSituationOverride(receiveAction, Action.SITUATION_PUSH_RECEIVED);

        assertEquals("Should return situation override action",
                entry.getActionForSituation(Action.SITUATION_PUSH_OPENED), openAction);
        assertEquals("Should return situation override action",
                entry.getActionForSituation(Action.SITUATION_PUSH_RECEIVED), receiveAction);
        assertEquals("Should return default action when no situation overrides exist",
                entry.getActionForSituation(Action.SITUATION_MANUAL_INVOCATION), defaultAction);
    }
/**
     * Test situation overrides for an action entry
     */
Test situation overrides for an action entry
Test situation overrides for an action entry
@Test
    public void testEntryActionForSituation() {
        Action defaultAction = new TestAction();
        Action openAction = new TestAction();
        Action receiveAction = new TestAction();
        registry.registerAction(defaultAction, "action");
        ActionRegistry.Entry entry = registry.registerAction(defaultAction, "action");
        entry.addSituationOverride(openAction, Action.SITUATION_PUSH_OPENED);
        entry.addSituationOverride(receiveAction, Action.SITUATION_PUSH_RECEIVED);
        assertEquals("Should return situation override action",
                entry.getActionForSituation(Action.SITUATION_PUSH_OPENED), openAction);
        assertEquals("Should return situation override action",
                entry.getActionForSituation(Action.SITUATION_PUSH_RECEIVED), receiveAction);
        assertEquals("Should return default action when no situation overrides exist",
                entry.getActionForSituation(Action.SITUATION_MANUAL_INVOCATION), defaultAction);
    }
@ Test public void testEntryActionForSituation ( ) { Action defaultAction = new TestAction ( ) ; Action openAction = new TestAction ( ) ; Action receiveAction = new TestAction ( ) ; registry . registerAction ( defaultAction , "action" ) ; ActionRegistry . Entry entry = registry . registerAction ( defaultAction , "action" ) ; entry . addSituationOverride ( openAction , Action . SITUATION_PUSH_OPENED ) ; entry . addSituationOverride ( receiveAction , Action . SITUATION_PUSH_RECEIVED ) ; assertEquals ( "Should return situation override action" , entry . getActionForSituation ( Action . SITUATION_PUSH_OPENED ) , openAction ) ; assertEquals ( "Should return situation override action" , entry . getActionForSituation ( Action . SITUATION_PUSH_RECEIVED ) , receiveAction ) ; assertEquals ( "Should return default action when no situation overrides exist" , entry . getActionForSituation ( Action . SITUATION_MANUAL_INVOCATION ) , defaultAction ) ; }
Test situation overrides for an action entry
Test situation overrides for an action entry