Skip to content

Commit

Permalink
Add a test for a domain that contains an invalid IDN character
Browse files Browse the repository at this point in the history
  • Loading branch information
arteymix committed Dec 12, 2023
1 parent f44fad6 commit ac73a88
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ public void validate_whenIdnIsEnabledAndDomainHasUnicodeSymbols_thenAccept() {
verifyNoInteractions( e );
}

@Test
public void validate_whenIdnIsEnabledAndDomainHasInvalidUnicodeSymbols_thenReject() {
v = new EmailValidator( (AllowedDomainStrategy) null, true );
// that's the code for a chequered flag 🏁
v.validate( "foo@B\uD83C\uDFC1cher.example", e );
verify( e ).rejectValue( isNull(), eq( "EmailValidator.domainNotConformToRfc3490" ), any(), isNull() );
}

@Test
public void validate_whenDomainContainsUnsupportedCharacters_thenReject() {
v.validate( "foo@Bücher.example", e );
Expand Down

0 comments on commit ac73a88

Please sign in to comment.