OKW_Helper { public static String concatListString( ArrayList<String> fps_ListString2Concat, String fps_Delimiter ) { String lvsReturn = ""; Log.LogFunctionStartDebug("OKW_Helper.ListStringConcat", "fps_ListString2Concat", fps_ListString2Concat.toString(), "fps_Separator", fps_Delimiter); try { StringBuilder sb = new StringBuilder(); for (int i=0; i<fps_ListString2Concat.size(); i++) { if (i > 0) { sb.append(fps_Delimiter); } sb.append(fps_ListString2Concat.get(i)); } lvsReturn = sb.toString(); } finally { Log.LogFunctionEndDebug(lvsReturn); } return lvsReturn; }  static String Boolean2String( Boolean fpbTrueOrFalse ); static String getLeftFromDelimiterNumber( String fpsSource, String fpsDelimiter, Integer fpiCount ); static String getRightFromDelimiterNumber( String fpsSource, String fpsDelimiter, Integer fpiCount ); static Boolean compareListString( List<String> ListString1, List<String> ListString2 ); static String concatListString( ArrayList<String> fps_ListString2Concat, String fps_Delimiter ); static Boolean matchString( String fpsPattern, String fpsStringToMatch ); static Boolean matchStrIgnoreCase( String fpsPattern, String fpsStringToMatch ); static String removeBeginEndQuotations( String fps_StringinQuotations ); static ArrayList<String> StringArray2ListStr( String[] fpsStringArray ); static Boolean String2Boolean( String fpsTrueOrFalse ); static ArrayList<String> splitString(String fpsString2Split, String fpsSeparator); static String repeatString( char c, Integer n ); static String repeatString( String c, Integer n ); static Boolean isStringNullOrEmpty( String fpsString);  }
@Test public void tcListStringConcat_With1CharacterSeparator() { String actual = ""; ArrayList<String> Input = new ArrayList<String>(); Input.clear(); actual = OKW_Helper.concatListString(Input, "/"); assertEquals("", actual); Input.clear(); Input.add("Hase"); actual = OKW_Helper.concatListString(Input, "/"); assertEquals("Hase", actual); Input.clear(); Input.add("Hase"); Input.add("Fuchs"); actual = OKW_Helper.concatListString(Input, "/"); assertEquals("Hase/Fuchs", actual); Input.clear(); Input.add("Hase"); Input.add("Fuchs"); Input.add("Bär"); actual = OKW_Helper.concatListString(Input, "/"); assertEquals("Hase/Fuchs/Bär", actual); }
@Test public void tcListStringConcat_WithMultipleCharacterSeparator() { String actual = ""; ArrayList<String> Input = new ArrayList<String>(); Input.clear(); actual = OKW_Helper.concatListString(Input, "${SEP}"); assertEquals("", actual); Input.clear(); Input.add("Hase"); actual = OKW_Helper.concatListString(Input, "${SEP}"); assertEquals("Hase", actual); Input.clear(); Input.add("Hase"); Input.add("Fuchs"); actual = OKW_Helper.concatListString(Input, "${SEP}"); assertEquals("Hase${SEP}Fuchs", actual); Input.clear(); Input.add("Hase"); Input.add("Fuchs"); Input.add("Bär"); actual = OKW_Helper.concatListString(Input, "${SEP}"); assertEquals("Hase${SEP}Fuchs${SEP}Bär", actual); Input.clear(); Input.add("Hase"); Input.add(""); Input.add("Bär"); actual = OKW_Helper.concatListString(Input, "${SEP}"); assertEquals("Hase${SEP}${SEP}Bär", actual); Input.clear(); Input.add(""); Input.add("Fuchs"); Input.add(""); actual = OKW_Helper.concatListString(Input, "${SEP}"); assertEquals("${SEP}Fuchs${SEP}", actual); }
@Test public void tcListStringConcat_WithOut_Separator() { String actual = ""; ArrayList<String> Input = new ArrayList<String>(); Input.clear(); actual = OKW_Helper.concatListString(Input, ""); assertEquals("", actual); Input.clear(); Input.add("Hase"); actual = OKW_Helper.concatListString(Input, ""); assertEquals("Hase", actual); Input.clear(); Input.add("Hase"); Input.add("Fuchs"); actual = OKW_Helper.concatListString(Input, ""); assertEquals("HaseFuchs", actual); Input.clear(); Input.add("Hase"); Input.add("Fuchs"); Input.add("Bär"); actual = OKW_Helper.concatListString(Input, ""); assertEquals("HaseFuchsBär", actual); }