@Test public void stringLengthOf0() { parameter.put("stringLength", String.valueOf(0)); StringConstraint constr = new StringConstraint(parameter); String testStr = fillString('x', 100); String resultString = constr.crop(testStr); assertThat(resultString, isEmptyString()); }
public String crop(String string) { if ((null == string) || (string.length() <= effectiveStringLength)) { return string; } if (effectiveStringLength == 0) { return ""; } String cropped = string.substring(0, effectiveStringLength); if (USE_TRAILING_DOTS) { cropped = appendTrailingDots(cropped); } return cropped; }
StringConstraint { public String crop(String string) { if ((null == string) || (string.length() <= effectiveStringLength)) { return string; } if (effectiveStringLength == 0) { return ""; } String cropped = string.substring(0, effectiveStringLength); if (USE_TRAILING_DOTS) { cropped = appendTrailingDots(cropped); } return cropped; } }
StringConstraint { public String crop(String string) { if ((null == string) || (string.length() <= effectiveStringLength)) { return string; } if (effectiveStringLength == 0) { return ""; } String cropped = string.substring(0, effectiveStringLength); if (USE_TRAILING_DOTS) { cropped = appendTrailingDots(cropped); } return cropped; } StringConstraint(Map<String, Object> parameter); }
StringConstraint { public String crop(String string) { if ((null == string) || (string.length() <= effectiveStringLength)) { return string; } if (effectiveStringLength == 0) { return ""; } String cropped = string.substring(0, effectiveStringLength); if (USE_TRAILING_DOTS) { cropped = appendTrailingDots(cropped); } return cropped; } StringConstraint(Map<String, Object> parameter); String crop(String string); Map<String, String[]> crop(final Map<String, String[]> original); String cropKeepFinalCharacter(String string, char finalChar); }
StringConstraint { public String crop(String string) { if ((null == string) || (string.length() <= effectiveStringLength)) { return string; } if (effectiveStringLength == 0) { return ""; } String cropped = string.substring(0, effectiveStringLength); if (USE_TRAILING_DOTS) { cropped = appendTrailingDots(cropped); } return cropped; } StringConstraint(Map<String, Object> parameter); String crop(String string); Map<String, String[]> crop(final Map<String, String[]> original); String cropKeepFinalCharacter(String string, char finalChar);  }