@Test public void short_string_null_1_returns_empty_string() { assertEquals("", SimpleStringUtils.shortString(null, 1)); }
public static String shortString(String string, int max) { if (max==0){ return EMPTY; } if (string ==null){ return EMPTY; } if (string.length()<=max){ return string; } if (max==1){ return "."; } if (max==2){ return ".."; } if (max==3){ return "..."; } StringBuilder sb =new StringBuilder(); sb.append( string.substring(0, max-3)); sb.append("..."); return sb.toString(); }
SimpleStringUtils { public static String shortString(String string, int max) { if (max==0){ return EMPTY; } if (string ==null){ return EMPTY; } if (string.length()<=max){ return string; } if (max==1){ return "."; } if (max==2){ return ".."; } if (max==3){ return "..."; } StringBuilder sb =new StringBuilder(); sb.append( string.substring(0, max-3)); sb.append("..."); return sb.toString(); } }
SimpleStringUtils { public static String shortString(String string, int max) { if (max==0){ return EMPTY; } if (string ==null){ return EMPTY; } if (string.length()<=max){ return string; } if (max==1){ return "."; } if (max==2){ return ".."; } if (max==3){ return "..."; } StringBuilder sb =new StringBuilder(); sb.append( string.substring(0, max-3)); sb.append("..."); return sb.toString(); }  }
SimpleStringUtils { public static String shortString(String string, int max) { if (max==0){ return EMPTY; } if (string ==null){ return EMPTY; } if (string.length()<=max){ return string; } if (max==1){ return "."; } if (max==2){ return ".."; } if (max==3){ return "..."; } StringBuilder sb =new StringBuilder(); sb.append( string.substring(0, max-3)); sb.append("..."); return sb.toString(); }  static boolean equals(String text1, String text2); static String shortString(String string, int max); }
SimpleStringUtils { public static String shortString(String string, int max) { if (max==0){ return EMPTY; } if (string ==null){ return EMPTY; } if (string.length()<=max){ return string; } if (max==1){ return "."; } if (max==2){ return ".."; } if (max==3){ return "..."; } StringBuilder sb =new StringBuilder(); sb.append( string.substring(0, max-3)); sb.append("..."); return sb.toString(); }  static boolean equals(String text1, String text2); static String shortString(String string, int max);  }