### Question:
StringComplexFieldActions implements AtlasFieldAction { @AtlasActionProcessor public static String format(Format format, List<Object> input) { if (format == null || format.getTemplate() == null) { throw new IllegalArgumentException("Format must be specified with a template"); } return String.format(Locale.ROOT, format.getTemplate(), input == null ? null : input.toArray(new Object[0])); }  @AtlasActionProcessor static String append(Append append, String input); @AtlasActionProcessor(sourceType = FieldType.ANY) static String concatenate(Concatenate concat, List<String> inputs); @AtlasActionProcessor static Boolean endsWith(EndsWith endsWith, String input); @AtlasActionProcessor static String format(Format format, List<Object> input); @AtlasActionProcessor static String genareteUUID(GenerateUUID action); @AtlasActionProcessor static Number indexOf(IndexOf indexOf, String input); @AtlasActionProcessor static Number lastIndexOf(LastIndexOf lastIndexOf, String input); @AtlasActionProcessor static String padStringRight(PadStringRight padStringRight, String input); @AtlasActionProcessor static String padStringLeft(PadStringLeft padStringLeft, String input); @AtlasActionProcessor static String prepend(Prepend action, String input); @AtlasActionProcessor static String replaceAll(ReplaceAll replaceAll, String input); @AtlasActionProcessor static String replaceFirst(ReplaceFirst replaceFirst, String input); @AtlasActionProcessor(sourceType = FieldType.ANY) static String[] split(Split split, String input); @AtlasActionProcessor(sourceType = FieldType.ANY) static String[] repeat(Repeat repeat, String input); @AtlasActionProcessor static Boolean startsWith(StartsWith startsWith, String input); @AtlasActionProcessor static String subString(SubString subString, String input); @AtlasActionProcessor static String subStringAfter(SubStringAfter subStringAfter, String input); @AtlasActionProcessor static String subStringBefore(SubStringBefore subStringBefore, String input); static final String STRING_SEPARATOR_REGEX; static final Pattern STRING_SEPARATOR_PATTERN; }### Answer:
@Test public void testFormat() { Format action = new Format(); action.setTemplate("foofoo"); assertEquals("foofoo", StringComplexFieldActions.format(action, null)); assertEquals("foofoo", StringComplexFieldActions.format(action, Arrays.asList(""))); assertEquals("foofoo", StringComplexFieldActions.format(action, Arrays.asList("bar"))); action.setTemplate("foo%sfoo"); assertEquals("foonullfoo", StringComplexFieldActions.format(action, null)); assertEquals("foofoo", StringComplexFieldActions.format(action, Arrays.asList(""))); assertEquals("foobarfoo", StringComplexFieldActions.format(action, Arrays.asList("bar"))); action.setTemplate("foo%1$sfoo%1$s"); assertEquals("foobarfoobar", StringComplexFieldActions.format(action, Arrays.asList("bar"))); }
@Test(expected=IllegalArgumentException.class) public void testFormatNullAction() { StringComplexFieldActions.format(null, null); }
@Test(expected=IllegalArgumentException.class) public void testFormatNullTemplate() { StringComplexFieldActions.format(new Format(), null); }