Unit Testing, Property Based Testing.
have at least one PTB library. Good library options in Java are junit-quickcheck and Jqwik. Using Jqwik to test valid emails is straightforward due to the out of box valid email generator: @Property public void testValidEmails(@ForAll @Email(quotedLocalPart = true) String email) {