@Test public void testPadStringLeft() { PadStringLeft padStringLeft = new PadStringLeft(); padStringLeft.setPadCharacter("a"); padStringLeft.setPadCount(3); assertEquals("aaa", StringComplexFieldActions.padStringLeft(padStringLeft, null)); assertEquals("aaa", StringComplexFieldActions.padStringLeft(padStringLeft, "")); assertEquals("aaaa", StringComplexFieldActions.padStringLeft(padStringLeft, "a")); assertEquals("aaab", StringComplexFieldActions.padStringLeft(padStringLeft, "b")); try { StringComplexFieldActions.padStringLeft(null, "aa"); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { assertTrue(true); } try { StringComplexFieldActions.padStringLeft(new PadStringLeft(), "aa"); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { assertTrue(true); } try { PadStringLeft incomplete = new PadStringLeft(); incomplete.setPadCharacter("f"); StringComplexFieldActions.padStringLeft(incomplete, "aa"); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { assertTrue(true); } try { PadStringLeft incomplete = new PadStringLeft(); incomplete.setPadCount(3); StringComplexFieldActions.padStringLeft(incomplete, "aa"); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { assertTrue(true); } }
@AtlasActionProcessor public static String padStringLeft(PadStringLeft padStringLeft, String input) { if (padStringLeft == null || padStringLeft.getPadCharacter() == null || padStringLeft.getPadCount() == null) { throw new IllegalArgumentException("PadStringLeft must be specified with padCharacter and padCount"); } StringBuilder builder = new StringBuilder(); for (int i = 0; i < padStringLeft.getPadCount(); i++) { builder.append(padStringLeft.getPadCharacter()); } if (input != null) { builder.append(input); } return builder.toString(); }
StringComplexFieldActions implements AtlasFieldAction { @AtlasActionProcessor public static String padStringLeft(PadStringLeft padStringLeft, String input) { if (padStringLeft == null || padStringLeft.getPadCharacter() == null || padStringLeft.getPadCount() == null) { throw new IllegalArgumentException("PadStringLeft must be specified with padCharacter and padCount"); } StringBuilder builder = new StringBuilder(); for (int i = 0; i < padStringLeft.getPadCount(); i++) { builder.append(padStringLeft.getPadCharacter()); } if (input != null) { builder.append(input); } return builder.toString(); } }
StringComplexFieldActions implements AtlasFieldAction { @AtlasActionProcessor public static String padStringLeft(PadStringLeft padStringLeft, String input) { if (padStringLeft == null || padStringLeft.getPadCharacter() == null || padStringLeft.getPadCount() == null) { throw new IllegalArgumentException("PadStringLeft must be specified with padCharacter and padCount"); } StringBuilder builder = new StringBuilder(); for (int i = 0; i < padStringLeft.getPadCount(); i++) { builder.append(padStringLeft.getPadCharacter()); } if (input != null) { builder.append(input); } return builder.toString(); }  }
StringComplexFieldActions implements AtlasFieldAction { @AtlasActionProcessor public static String padStringLeft(PadStringLeft padStringLeft, String input) { if (padStringLeft == null || padStringLeft.getPadCharacter() == null || padStringLeft.getPadCount() == null) { throw new IllegalArgumentException("PadStringLeft must be specified with padCharacter and padCount"); } StringBuilder builder = new StringBuilder(); for (int i = 0; i < padStringLeft.getPadCount(); i++) { builder.append(padStringLeft.getPadCharacter()); } if (input != null) { builder.append(input); } return builder.toString(); }  @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); }
StringComplexFieldActions implements AtlasFieldAction { @AtlasActionProcessor public static String padStringLeft(PadStringLeft padStringLeft, String input) { if (padStringLeft == null || padStringLeft.getPadCharacter() == null || padStringLeft.getPadCount() == null) { throw new IllegalArgumentException("PadStringLeft must be specified with padCharacter and padCount"); } StringBuilder builder = new StringBuilder(); for (int i = 0; i < padStringLeft.getPadCount(); i++) { builder.append(padStringLeft.getPadCharacter()); } if (input != null) { builder.append(input); } return builder.toString(); }  @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; }