EmailValidator { public boolean validate(final String hex) { matcher = pattern.matcher(hex); return matcher.matches(); } EmailValidator(); boolean validate(final String hex);  }
@Test public void testValidate_invalidEmail() throws Exception { assertThat(tested.validate("foo")).isFalse(); assertThat(tested.validate("foo@")).isFalse(); assertThat(tested.validate("foo@gmail")).isFalse(); }
@Test public void testValidate_validEmail() throws Exception { assertThat(tested.validate("foo@gmail.com")).isTrue(); }