OpenExternalUrlAction 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: if (UriUtils.parse(arguments.getValue().getString()) == null) { return false; } return UAirship.shared().getUrlAllowList().isAllowed(arguments.getValue().getString(), UrlAllowList.SCOPE_OPEN_URL); case Action.SITUATION_BACKGROUND_NOTIFICATION_ACTION_BUTTON: case Action.SITUATION_PUSH_RECEIVED: default: return false; } }  @NonNull @Override ActionResult perform(@NonNull ActionArguments arguments); @Override boolean acceptsArguments(@NonNull ActionArguments arguments); @Override boolean shouldRunOnMainThread(); @NonNull
    static final String DEFAULT_REGISTRY_NAME; @NonNull
    static final String DEFAULT_REGISTRY_SHORT_NAME; }
@Test public void testAcceptsArguments() throws MalformedURLException { urlAllowList.addEntry("*"); ActionArguments args = ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, "http: assertTrue("Should accept valid url string", action.acceptsArguments(args)); args = ActionTestUtils.createArgs(Action.SITUATION_PUSH_OPENED, "http: assertTrue("Should accept valid url", action.acceptsArguments(args)); args = ActionTestUtils.createArgs(Action.SITUATION_FOREGROUND_NOTIFICATION_ACTION_BUTTON, "http: assertTrue("Should accept Action.SITUATION_FOREGROUND_NOTIFICATION_ACTION_BUTTON", action.acceptsArguments(args)); args = ActionTestUtils.createArgs(Action.SITUATION_PUSH_RECEIVED, "http: assertFalse("Should not accept Action.SITUATION_PUSH_RECEIVED", action.acceptsArguments(args)); }
@Test public void testUrlAllowList() { urlAllowList.addEntry("https: assertTrue(action.acceptsArguments(ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, "https: assertFalse(action.acceptsArguments(ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, "https: }