public ArgsConverter(String[] options) { super(WORD, WORD); if (options != null) { if (options.length == 1) { converter.setFieldName(options[0]); } } }
@Override public void start() { converter.setFieldName(getFirstOption()); super.start(); } }
@Test public void testNonEmbeddedEmpty() { DefaultArgsConverter ac = new DefaultArgsConverter(); ac.setFieldName(PREFIX); assertThat(formatArgs(ac, NO_ARGS), is(EMPTY)); }
@Test public void testNonEmbeddedStrangeFieldName() throws JSONObjectException, IOException { DefaultArgsConverter ac = new DefaultArgsConverter(); ac.setFieldName(STRANGE_SEQ); CustomField[] custFields = new CustomField[] { customField(STRANGE_SEQ, STRANGE_SEQ) }; assertThat(makeMap(custFields), is(mapFrom(formatArgs(ac, custFields)).get(STRANGE_SEQ))); }
@Test public void testNonEmbeddedSingleArg() throws JSONObjectException, IOException { DefaultArgsConverter ac = new DefaultArgsConverter(); ac.setFieldName(PREFIX); CustomField[] custFields = new CustomField[] { customField(SOME_KEY, SOME_VALUE) }; assertThat(makeMap(custFields), is(mapFrom(formatArgs(ac, custFields)).get(PREFIX))); }
@Test public void testNonEmbeddedStrangeValue() throws JSONObjectException, IOException { DefaultArgsConverter ac = new DefaultArgsConverter(); ac.setFieldName(PREFIX); CustomField[] custFields = new CustomField[] { customField(SOME_KEY, STRANGE_SEQ) }; assertThat(makeMap(custFields), is(mapFrom(formatArgs(ac, custFields)).get(PREFIX))); }
@Test public void testNonEmbeddedStrangeKey() throws JSONObjectException, IOException { DefaultArgsConverter ac = new DefaultArgsConverter(); ac.setFieldName(PREFIX); CustomField[] custFields = new CustomField[] { customField(STRANGE_SEQ, STRANGE_SEQ) }; assertThat(makeMap(custFields), is(mapFrom(formatArgs(ac, custFields)).get(PREFIX))); }