Create util method to check if email is empty
- Create method to check if email is empty or the default AuthMe email (avoids repetition) - Check that input email has '@' inside text (relates to #1105)
This commit is contained in:
@@ -22,7 +22,7 @@ import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
public class UtilsTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void setAuthmeInstance() {
|
||||
public static void initLogger() {
|
||||
TestHelper.setupLogger();
|
||||
}
|
||||
|
||||
@@ -105,4 +105,16 @@ public class UtilsTest {
|
||||
assertThat(Utils.isClassLoaded("org.bukkit.event.player.PlayerFishEvent"), equalTo(true));
|
||||
assertThat(Utils.isClassLoaded("com.someclass.doesnot.exist"), equalTo(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldDetectIfEmailIsEmpty() {
|
||||
// given / when / then
|
||||
assertThat(Utils.isEmailEmpty(""), equalTo(true));
|
||||
assertThat(Utils.isEmailEmpty(null), equalTo(true));
|
||||
assertThat(Utils.isEmailEmpty("your@email.com"), equalTo(true));
|
||||
assertThat(Utils.isEmailEmpty("Your@Email.com"), equalTo(true));
|
||||
|
||||
assertThat(Utils.isEmailEmpty("my@example.org"), equalTo(false));
|
||||
assertThat(Utils.isEmailEmpty("hey"), equalTo(false));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user