StringUtil { public static boolean isValidEmail( String email ) { EmailValidator emailvalidator = EmailValidator.getInstance(); return emailvalidator.isValid( email ); } private  StringUtil(); static String escapeHtml( String str ); static boolean isBase64( String str ); static boolean isValidSshPublicKey( String sshKey ); static String unEscapeHtml( String str ); static boolean containsHtml( String str ); static String removeHtml( String str ); static String removeHtmlAndSpecialChars( String str, boolean removeSpaces ); static String removeSpecialChars( String str, boolean removeSpaces ); static boolean isValidEmail( String email );  }
@Test public void testIsValidEmail() { assertTrue( StringUtil.isValidEmail( "valid@email.com" ) ); assertFalse( StringUtil.isValidEmail( "invalidemail@com" ) ); assertFalse( StringUtil.isValidEmail( null ) ); assertFalse( StringUtil.isValidEmail( "" ) ); }