package convalida.validators;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;

/**
 * @author Wellington Costa on 01/11/2017.
 */
public class EmailValidatorTest extends BaseTest {

    @Test
    public void invalidEmail() throws Exception {
        String value = "test@email";

        EmailValidator validator = new EmailValidator();
        EmailValidator validatorWithEditText = new EmailValidator(mockEditText, errorMessage);
        EmailValidator validatorWithTextInputLayout = new EmailValidator(mockTextInputLayout, errorMessage);

        when(mockEditText.getText().toString()).thenReturn(value);

        assertEquals(validator.isNotValid(value), true);
        assertEquals(validatorWithEditText.validate(), false);
        assertEquals(validatorWithTextInputLayout.validate(), false);
    }

    @Test
    public void validEmail() throws Exception {
        String value = "test@email.com";

        EmailValidator validator = new EmailValidator();
        EmailValidator validatorWithEditText = new EmailValidator(mockEditText, errorMessage);
        EmailValidator validatorWithTextInputLayout = new EmailValidator(mockTextInputLayout, errorMessage);

        when(mockEditText.getText().toString()).thenReturn(value);

        assertEquals(validator.isNotValid(value), false);
        assertEquals(validatorWithEditText.validate(), true);
        assertEquals(validatorWithTextInputLayout.validate(), true);
    }

}
@@ -267,39 +267,188 @@
 oid 
-invalidEmail() throws Exception
+emailIsNull() %7B%0A        EmailValidator validator = new EmailValidator();%0A        assertEquals(validator.isNotValid(null), true);%0A    %7D%0A    %0A    @Test%0A    public void invalidEmail()
  %7B%0A 
@@ -1053,25 +1053,8 @@
 il()
- throws Exception
  %7B%0A 
@@ -1620,9 +1620,10 @@
 %0A    %7D%0A%0A
-
 %7D
+%0A

Update EmailValidatorTest.java