@Test public void testRunWithDefaultNonList() throws ArgumentParserException { attrs.put("dest", "default"); act.run(null, arg, attrs, null, "hello"); assertEquals(singletonList("hello"), attrs.get("dest")); }
@Override public void run(ArgumentParser parser, Argument arg, Map<String, Object> attrs, String flag, Object value) throws ArgumentParserException { if (attrs.containsKey(arg.getDest())) { Object obj = attrs.get(arg.getDest()); if (obj instanceof List) { ((List<Object>) obj).add(value); return; } } List<Object> list = new ArrayList<Object>(); list.add(value); attrs.put(arg.getDest(), list); }
AppendArgumentAction implements ArgumentAction { @Override public void run(ArgumentParser parser, Argument arg, Map<String, Object> attrs, String flag, Object value) throws ArgumentParserException { if (attrs.containsKey(arg.getDest())) { Object obj = attrs.get(arg.getDest()); if (obj instanceof List) { ((List<Object>) obj).add(value); return; } } List<Object> list = new ArrayList<Object>(); list.add(value); attrs.put(arg.getDest(), list); } }
AppendArgumentAction implements ArgumentAction { @Override public void run(ArgumentParser parser, Argument arg, Map<String, Object> attrs, String flag, Object value) throws ArgumentParserException { if (attrs.containsKey(arg.getDest())) { Object obj = attrs.get(arg.getDest()); if (obj instanceof List) { ((List<Object>) obj).add(value); return; } } List<Object> list = new ArrayList<Object>(); list.add(value); attrs.put(arg.getDest(), list); }  }
AppendArgumentAction implements ArgumentAction { @Override public void run(ArgumentParser parser, Argument arg, Map<String, Object> attrs, String flag, Object value) throws ArgumentParserException { if (attrs.containsKey(arg.getDest())) { Object obj = attrs.get(arg.getDest()); if (obj instanceof List) { ((List<Object>) obj).add(value); return; } } List<Object> list = new ArrayList<Object>(); list.add(value); attrs.put(arg.getDest(), list); }  @Override void run(ArgumentParser parser, Argument arg,
            Map<String, Object> attrs, String flag, Object value); @Override boolean consumeArgument(); @Override void onAttach(Argument arg); }
AppendArgumentAction implements ArgumentAction { @Override public void run(ArgumentParser parser, Argument arg, Map<String, Object> attrs, String flag, Object value) throws ArgumentParserException { if (attrs.containsKey(arg.getDest())) { Object obj = attrs.get(arg.getDest()); if (obj instanceof List) { ((List<Object>) obj).add(value); return; } } List<Object> list = new ArrayList<Object>(); list.add(value); attrs.put(arg.getDest(), list); }  @Override void run(ArgumentParser parser, Argument arg,
            Map<String, Object> attrs, String flag, Object value); @Override boolean consumeArgument(); @Override void onAttach(Argument arg);  }