@Test public void cleanValueShouldReturnNullIfNullString() { TextValueCleaner textValueCleaner = new TextValueCleaner(); String cleanedValue = textValueCleaner.cleanVal(null); assertNull(cleanedValue); }
public String cleanVal(@Nullable String value) { String cleanValue = value; if (cleanValue != null) { if (cleanValue.contains(TAB)) { cleanValue = cleanValue.replace(TAB, SPACE); } if (cleanValue.contains(COMA)) { cleanValue = cleanValue.replace(COMA, SPACE); } if (cleanValue.contains(NEWLINE)) { cleanValue = cleanValue.replace(NEWLINE, SPACE); } } return cleanValue; }
TextValueCleaner { public String cleanVal(@Nullable String value) { String cleanValue = value; if (cleanValue != null) { if (cleanValue.contains(TAB)) { cleanValue = cleanValue.replace(TAB, SPACE); } if (cleanValue.contains(COMA)) { cleanValue = cleanValue.replace(COMA, SPACE); } if (cleanValue.contains(NEWLINE)) { cleanValue = cleanValue.replace(NEWLINE, SPACE); } } return cleanValue; } }
TextValueCleaner { public String cleanVal(@Nullable String value) { String cleanValue = value; if (cleanValue != null) { if (cleanValue.contains(TAB)) { cleanValue = cleanValue.replace(TAB, SPACE); } if (cleanValue.contains(COMA)) { cleanValue = cleanValue.replace(COMA, SPACE); } if (cleanValue.contains(NEWLINE)) { cleanValue = cleanValue.replace(NEWLINE, SPACE); } } return cleanValue; } @Inject  TextValueCleaner(); }
TextValueCleaner { public String cleanVal(@Nullable String value) { String cleanValue = value; if (cleanValue != null) { if (cleanValue.contains(TAB)) { cleanValue = cleanValue.replace(TAB, SPACE); } if (cleanValue.contains(COMA)) { cleanValue = cleanValue.replace(COMA, SPACE); } if (cleanValue.contains(NEWLINE)) { cleanValue = cleanValue.replace(NEWLINE, SPACE); } } return cleanValue; } @Inject  TextValueCleaner(); String cleanVal(@Nullable String value); String sanitizeValue(@Nullable String value); }
TextValueCleaner { public String cleanVal(@Nullable String value) { String cleanValue = value; if (cleanValue != null) { if (cleanValue.contains(TAB)) { cleanValue = cleanValue.replace(TAB, SPACE); } if (cleanValue.contains(COMA)) { cleanValue = cleanValue.replace(COMA, SPACE); } if (cleanValue.contains(NEWLINE)) { cleanValue = cleanValue.replace(NEWLINE, SPACE); } } return cleanValue; } @Inject  TextValueCleaner(); String cleanVal(@Nullable String value); String sanitizeValue(@Nullable String value);  }