-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing that EmailParts launches exceptions for nulls and invalid emails
- Loading branch information
1 parent
7c18d68
commit 2be1b69
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,4 +62,58 @@ public void shouldReturnGmail() throws InvalidEmailException { | |
public void shouldReturnHitmail() throws InvalidEmailException { | ||
assertEquals("hitmail", ep.getDomainWithoutTld("[email protected]")); | ||
} | ||
|
||
@Test | ||
public void shouldLaunchAnInvalidEmailExceptionForNullAtGetTld() throws InvalidEmailException { | ||
try { | ||
ep.getTld(null); | ||
} catch (InvalidEmailException e) { | ||
return; //This is what we expect | ||
} | ||
} | ||
|
||
@Test | ||
public void shouldLaunchAnInvalidEmailExceptionForNopeAtGetTld() throws InvalidEmailException { | ||
try { | ||
ep.getTld("nope"); | ||
} catch (InvalidEmailException e) { | ||
return; //This is what we expect | ||
} | ||
} | ||
|
||
@Test | ||
public void shouldLaunchAnInvalidEmailExceptionForNullAtGetDomain() throws InvalidEmailException { | ||
try { | ||
ep.getDomain(null); | ||
} catch (InvalidEmailException e) { | ||
return; //This is what we expect | ||
} | ||
} | ||
|
||
@Test | ||
public void shouldLaunchAnInvalidEmailExceptionForNopeAtGetDomain() throws InvalidEmailException { | ||
try { | ||
ep.getDomain("nope"); | ||
} catch (InvalidEmailException e) { | ||
return; //This is what we expect | ||
} | ||
} | ||
|
||
@Test | ||
public void shouldLaunchAnInvalidEmailExceptionForNullAtGetDomainWoTld() throws InvalidEmailException { | ||
try { | ||
ep.getDomainWithoutTld(null); | ||
} catch (InvalidEmailException e) { | ||
return; //This is what we expect | ||
} | ||
} | ||
|
||
@Test | ||
public void shouldLaunchAnInvalidEmailExceptionForNopeAtGetDomainWoTld() throws InvalidEmailException { | ||
try { | ||
ep.getDomainWithoutTld("nope"); | ||
} catch (InvalidEmailException e) { | ||
return; //This is what we expect | ||
} | ||
} | ||
} |