package bankservice.domain.model.client; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import java.util.stream.Stream; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; class EmailSpecificationTest { private final Email.EmailSpecification specification = new Email.EmailSpecification(); @SuppressWarnings("unused") private static Stream<Arguments> emails() { return Stream.of( Arguments.of("[email protected]", true), Arguments.of("[email protected]", true), Arguments.of("[email protected]", true), Arguments.of("[email protected]", true), Arguments.of("emailexample", false), Arguments.of("email@example", false), Arguments.of("[email protected]", false), Arguments.of("[email protected]", false), Arguments.of("[email protected]", false), Arguments.of("[email protected]", false), Arguments.of("[email protected]", false) ); } @MethodSource("emails") @ParameterizedTest void validate(String value, boolean isValid) { assertThat(specification.isSatisfiedBy(value), equalTo(isValid)); } }