feat: add tests for bonus exercises

This commit is contained in:
2026-04-16 17:46:21 +03:30
parent ab02836a30
commit ce2268ac06
4 changed files with 202 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestEmail {
static BonusExercises ex;
@BeforeAll
static void setUp() {
ex = new BonusExercises();
}
@Test
void testEmail0() {
assertTrue(ex.validateEmail("john.doe@example.com"));
}
@Test
void testEmail1() {
assertFalse(ex.validateEmail("hello world@example.com"));
}
@Test
void testEmail2() {
assertTrue(ex.validateEmail("alice_bob123@research-lab.co.uk"));
}
@Test
void testEmail3() {
assertFalse(ex.validateEmail("user@ex_ample.com"));
}
@Test
void testEmail4() {
assertFalse(ex.validateEmail("user.@-example.com"));
}
}