@Test public void emailValidator_CorrectEmailSimple_ReturnsTrue() { assertThat(EmailValidator.isValidEmail("name@email.com"), is(true)); }
public static boolean isValidEmail(String email){ if (null==email || "".equals(email)) return false; Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"); Matcher m = p.matcher(email); return m.matches(); }
EmailValidator { public static boolean isValidEmail(String email){ if (null==email || "".equals(email)) return false; Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"); Matcher m = p.matcher(email); return m.matches(); } }
EmailValidator { public static boolean isValidEmail(String email){ if (null==email || "".equals(email)) return false; Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"); Matcher m = p.matcher(email); return m.matches(); }  }
EmailValidator { public static boolean isValidEmail(String email){ if (null==email || "".equals(email)) return false; Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"); Matcher m = p.matcher(email); return m.matches(); }  static boolean isValidEmail(String email); }
EmailValidator { public static boolean isValidEmail(String email){ if (null==email || "".equals(email)) return false; Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"); Matcher m = p.matcher(email); return m.matches(); }  static boolean isValidEmail(String email);  }