TextUtils { public static boolean containsBlanks(final CharSequence s) { if (s == null) { return false; } for (int i = 0; i < s.length(); i++) { if (Character.isWhitespace(s.charAt(i))) { return true; } } return false; } private  TextUtils(); static boolean isEmpty(final CharSequence s); static boolean isBlank(final CharSequence s); static boolean containsBlanks(final CharSequence s); static String toHexString(final byte[] bytes);  }
@Test public void testTextContainsBlanks() { Assert.assertFalse(TextUtils.containsBlanks(null)); Assert.assertFalse(TextUtils.containsBlanks("")); Assert.assertTrue(TextUtils.containsBlanks(" ")); Assert.assertTrue(TextUtils.containsBlanks("\t")); Assert.assertTrue(TextUtils.containsBlanks(" a")); Assert.assertFalse(TextUtils.containsBlanks("a")); }