TweetTextLinkifier { static CharSequence trimEnd(CharSequence charSequence) { int length = charSequence.length(); while ((length > 0) && (charSequence.charAt(length - 1) <= ' ')) { length--; } return length < charSequence.length() ? charSequence.subSequence(0, length) : charSequence; } private  TweetTextLinkifier();   }
@Test public void testTrimEnd_withoutTrailingSpace() { assertSame(BASE_TEXT, TweetTextLinkifier.trimEnd(BASE_TEXT)); }
@Test public void testTrimEnd_withTrailingSpace() { final CharSequence result = TweetTextLinkifier.trimEnd(BASE_TEXT + "\n\r\t "); assertEquals(BASE_TEXT, result); assertNotSame(BASE_TEXT, result); }