Created
March 10, 2013 20:13
-
-
Save izmajlowiczl/5130219 to your computer and use it in GitHub Desktop.
TestingExceptionsWithMessage
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
@Test | |
public void GetScore_GetForNotExistingUser_ThrowException() { | |
final UserScoreRepository userScoreRepositoryStub = Make_FakeUserScoreRepository(); | |
final UserScoreService userScore = new UserScoreService(userScoreRepositoryStub); | |
final User fakeUser = null; | |
try { | |
final int userPoints = userScore.get(fakeUser); | |
} catch (IllegalArgumentException e) { | |
final String errorMessage = "User Is null"; | |
assertEquals(errorMessage, e.getMessage()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment