Skip to content

Instantly share code, notes, and snippets.

@izmajlowiczl
Created March 10, 2013 20:13
Show Gist options
  • Save izmajlowiczl/5130219 to your computer and use it in GitHub Desktop.
Save izmajlowiczl/5130219 to your computer and use it in GitHub Desktop.
TestingExceptionsWithMessage
@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