AddCustomEventAction extends Action { @Override public boolean acceptsArguments(@NonNull ActionArguments arguments) { if (arguments.getValue().getMap() != null) { if (arguments.getValue().getMap().get("event_name") == null) { Logger.error("CustomEventAction requires an event name in the event data."); return false; } return true; } Logger.error("CustomEventAction requires a map of event data."); return false; }  @NonNull @Override ActionResult perform(@NonNull ActionArguments arguments); @Override boolean acceptsArguments(@NonNull ActionArguments arguments); @NonNull
    static final String DEFAULT_REGISTRY_NAME; }
@Test public void testAcceptsArgumentsAllSituations() { Map map = new HashMap(); map.put("event_name", "event name"); for (@Action.Situation int situation : acceptedSituations) { ActionArguments args = ActionTestUtils.createArgs(situation, map); assertTrue("Should accept arguments in situation " + situation, action.acceptsArguments(args)); } }
@Test public void testAcceptsArgumentsEmptyArgs() { ActionArguments args = ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, null); assertFalse("Should reject empty args", action.acceptsArguments(args)); }
@Test public void testAcceptsArgumentsEmptyMap() { ActionArguments args = ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, new HashMap()); assertFalse("Should reject empty map", action.acceptsArguments(args)); }
@Test public void testAcceptsArgumentsInvalidValue() { ActionArguments args = ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, "not valid"); assertFalse("Should reject non-map action argument values", action.acceptsArguments(args)); }