BaseTagsAction extends Action { @Override public boolean acceptsArguments(@NonNull ActionArguments arguments) { if (arguments.getValue().isNull()) { return false; } if (arguments.getValue().getString() != null) { return true; } if (arguments.getValue().getList() != null) { return true; } return arguments.getValue().getMap() != null; }  @Override boolean acceptsArguments(@NonNull ActionArguments arguments); @NonNull @Override ActionResult perform(@NonNull ActionArguments arguments);  }
@Test public void testAcceptsArguments() { ActionArguments args = ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, "tag1"); assertTrue("Single tag is an acceptable argument", action.acceptsArguments(args)); args = ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, "[tag1,tag2,tag3]"); assertTrue("JSON string of tags is an acceptable argument", action.acceptsArguments(args)); args = ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, "{group: [tag1, tag2, tag3]}"); assertTrue("JSON string of tags is an acceptable argument", action.acceptsArguments(args)); args = ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, 1); assertFalse("Integer object is invalid arguments", action.acceptsArguments(args)); args = ActionTestUtils.createArgs(Action.SITUATION_MANUAL_INVOCATION, null); assertFalse(action.acceptsArguments(args)); for (@Action.Situation int situation : acceptedSituations) { args = ActionTestUtils.createArgs(situation, "tag1"); assertTrue("Should accept arguments in situation " + situation, action.acceptsArguments(args)); } }