### Question:
CharType implements ExtendedType<String> { protected String rtrim(String value) { int end = value.length() - 1; int count = end; while (end >= 0 && value.charAt(end) <= ' ') { end--; } return end == count ? value : value.substring(0, end + 1); } CharType(boolean trimmingChars, boolean usingClobs); @Override String getClassName(); @Override String materializeObject(ResultSet rs, int index, int type); @Override String materializeObject(CallableStatement cs, int index, int type); @Override void setJdbcObject(PreparedStatement st, String value, int pos, int type, int scale); @Override String toString(String value); boolean isTrimmingChars(); void setTrimmingChars(boolean trimingChars); boolean isUsingClobs(); void setUsingClobs(boolean usingClobs);  }### Answer:
@Test public void testRightTrim() { CharType charType = new CharType(true, false); assertEquals(charType.rtrim(" text "), " text"); assertEquals(charType.rtrim(" text"), " text"); assertEquals(charType.rtrim("text"), "text"); assertEquals(charType.rtrim(" Pẹlẹ O \n"), " Pẹlẹ O"); assertEquals(charType.rtrim("Привет!\n"), "Привет!"); assertEquals(charType.rtrim("Привет!\t"), "Привет!"); }