Created
May 8, 2017 08:40
-
-
Save BalicantaYao/1c2c7f9c9f778aefc1a19bf4b8bdd1e0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public static class verfiyExceptionTest{ | |
@Rule | |
public ExpectedException thrown= ExpectedException.none(); | |
@Test | |
public void throwsExceptionWithMessage() { | |
// 預期 LoginFailed 會產生以及對應的 Exception message | |
thrown.expect(LoginFailedException.class); | |
thrown.expectMessage(startsWith("UserName")); | |
// 執行測試 | |
checkEmptyUserName(StringUtils.Empty); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment