StringUtil { @NonNull public static String controlToSpace(@Nullable String val) { String result = ""; if (val == null) { return result; } for (int i = 0; i < val.length(); i++) { if (val.charAt(i) < SPACE_CHAR) result = result + SPACE_CHAR; else result = result + val.charAt(i); } return result; }  static boolean isNullOrEmpty(@Nullable String s); @NonNull static String controlToSpace(@Nullable String val); static boolean isValid(@Nullable String value); static final char SPACE_CHAR; }
@Test public void controlToSpace_ShouldReturnEmptyIfNullValue() { String result = StringUtil.controlToSpace(null); assertEquals("", result); }
@Test public void controlToSpace_ShouldReturnEmptyIfEmptyValue() { String result = StringUtil.controlToSpace(""); assertEquals("", result); }
@Test public void controlToSpace_ShouldReturnStringWithoutControlChars() { String result = StringUtil.controlToSpace("" +'\u0010'+'\u0010'); assertEquals(" ", result); }