ShareAction extends Action { @Override public boolean acceptsArguments(@NonNull ActionArguments arguments) { switch (arguments.getSituation()) { case SITUATION_PUSH_OPENED: case SITUATION_WEB_VIEW_INVOCATION: case SITUATION_MANUAL_INVOCATION: case SITUATION_FOREGROUND_NOTIFICATION_ACTION_BUTTON: case SITUATION_AUTOMATION: return arguments.getValue().getString() != null; case SITUATION_BACKGROUND_NOTIFICATION_ACTION_BUTTON: case SITUATION_PUSH_RECEIVED: default: return false; } }  @Override boolean acceptsArguments(@NonNull ActionArguments arguments); @NonNull @Override ActionResult perform(@NonNull ActionArguments arguments); @Override boolean shouldRunOnMainThread(); @NonNull
    static final String DEFAULT_REGISTRY_NAME; @NonNull
    static final String DEFAULT_REGISTRY_SHORT_NAME; }
@Test public void testAcceptsArgs() { assertTrue(action.acceptsArguments(ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, "share text"))); assertTrue(action.acceptsArguments(ActionTestUtils.createArgs(Action.SITUATION_PUSH_OPENED, "share text"))); assertTrue(action.acceptsArguments(ActionTestUtils.createArgs(Action.SITUATION_WEB_VIEW_INVOCATION, "share text"))); assertTrue(action.acceptsArguments(ActionTestUtils.createArgs(Action.SITUATION_FOREGROUND_NOTIFICATION_ACTION_BUTTON, "share text"))); assertTrue(action.acceptsArguments(ActionTestUtils.createArgs(Action.SITUATION_AUTOMATION, "share text"))); }
@Test public void testRejectsPossibleBackgroundSituations() { assertFalse(action.acceptsArguments(ActionTestUtils.createArgs(Action.SITUATION_PUSH_RECEIVED, "share text"))); assertFalse(action.acceptsArguments(ActionTestUtils.createArgs(Action.SITUATION_BACKGROUND_NOTIFICATION_ACTION_BUTTON, "share text"))); }