{"action":"opened","number":476,"pull_request":{"url":"https://api.github.com/repos/joel-costigliola/assertj-core/pulls/476","id":41931519,"html_url":"https://github.com/joel-costigliola/assertj-core/pull/476","diff_url":"https://github.com/joel-costigliola/assertj-core/pull/476.diff","patch_url":"https://github.com/joel-costigliola/assertj-core/pull/476.patch","issue_url":"https://api.github.com/repos/joel-costigliola/assertj-core/issues/476","number":476,"state":"open","locked":false,"title":"Added assertThatException ","user":{"login":"glhez","id":10855953,"avatar_url":"https://avatars.githubusercontent.com/u/10855953?v=3","gravatar_id":"","url":"https://api.github.com/users/glhez","html_url":"https://github.com/glhez","followers_url":"https://api.github.com/users/glhez/followers","following_url":"https://api.github.com/users/glhez/following{/other_user}","gists_url":"https://api.github.com/users/glhez/gists{/gist_id}","starred_url":"https://api.github.com/users/glhez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glhez/subscriptions","organizations_url":"https://api.github.com/users/glhez/orgs","repos_url":"https://api.github.com/users/glhez/repos","events_url":"https://api.github.com/users/glhez/events{/privacy}","received_events_url":"https://api.github.com/users/glhez/received_events","type":"User","site_admin":false},"body":"Add `assertThatException` in complement of `assertThatThrownBy`.\r\n\r\nThis patches add two classes: `ExpectThrowableAssert` and `ChainedThrowableAssert`. The first delegate to the second and will check that the lambda actually throw an exception of expected type.\r\n\r\nAlso, this allow for chaining:\r\n\r\n```\r\nIntConsumer lambda = int n -> {\r\n  if (n < 0) throw new IllegalArgumentException(n + \" is negative\");\r\n  if (n > 100) throw new IllegalArgumentException(n + \" must be less or equals to 100\");\r\n}\r\nassertThatException(IllegalArgumentException.class)\r\n  .isThrownBy(() -> lambda.accept(-1))\r\n    .hasMessage(\"-1 is negative\")\r\n  .isThrownBy(() -> lambda.accept(101))\r\n    .hasMessage(\"101 must be less or equals to 100\")\r\n```\r\n\r\nTo be compared with the existing `assertThatThrownBy`:\r\n\r\n```\r\nassertThatThrownBy(() -> lambda.accept(-1))\r\n  .isInstanceOf(IllegalArgumentException.class)\r\n  .hasMessage(\"-1 is negative\")\r\n;\r\nassertThatThrownBy(() -> lambda.accept(101))\r\n  .isInstanceOf(IllegalArgumentException.class)\r\n  .hasMessage(\"101 must be less or equals to 100\")\r\n```\r\n\r\nAs said in the javadoc, `assertThatException` is named like that because of `assertThat(Class)` and type erasure.","created_at":"2015-08-07T20:43:57Z","updated_at":"2015-08-07T20:43:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/joel-costigliola/assertj-core/pulls/476/commits","review_comments_url":"https://api.github.com/repos/joel-costigliola/assertj-core/pulls/476/comments","review_comment_url":"https://api.github.com/repos/joel-costigliola/assertj-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/joel-costigliola/assertj-core/issues/476/comments","statuses_url":"https://api.github.com/repos/joel-costigliola/assertj-core/statuses/003cb769e0f629963e77af4cf64e75468e43440b","head":{"label":"glhez:j8/assertThatException","ref":"j8/assertThatException","sha":"003cb769e0f629963e77af4cf64e75468e43440b","user":{"login":"glhez","id":10855953,"avatar_url":"https://avatars.githubusercontent.com/u/10855953?v=3","gravatar_id":"","url":"https://api.github.com/users/glhez","html_url":"https://github.com/glhez","followers_url":"https://api.github.com/users/glhez/followers","following_url":"https://api.github.com/users/glhez/following{/other_user}","gists_url":"https://api.github.com/users/glhez/gists{/gist_id}","starred_url":"https://api.github.com/users/glhez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glhez/subscriptions","organizations_url":"https://api.github.com/users/glhez/orgs","repos_url":"https://api.github.com/users/glhez/repos","events_url":"https://api.github.com/users/glhez/events{/privacy}","received_events_url":"https://api.github.com/users/glhez/received_events","type":"User","site_admin":false},"repo":{"id":40271503,"name":"assertj-core","full_name":"glhez/assertj-core","owner":{"login":"glhez","id":10855953,"avatar_url":"https://avatars.githubusercontent.com/u/10855953?v=3","gravatar_id":"","url":"https://api.github.com/users/glhez","html_url":"https://github.com/glhez","followers_url":"https://api.github.com/users/glhez/followers","following_url":"https://api.github.com/users/glhez/following{/other_user}","gists_url":"https://api.github.com/users/glhez/gists{/gist_id}","starred_url":"https://api.github.com/users/glhez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glhez/subscriptions","organizations_url":"https://api.github.com/users/glhez/orgs","repos_url":"https://api.github.com/users/glhez/repos","events_url":"https://api.github.com/users/glhez/events{/privacy}","received_events_url":"https://api.github.com/users/glhez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/glhez/assertj-core","description":"AssertJ is a library of assertions similar to fest-assert but providing a richer set of assertions.","fork":true,"url":"https://api.github.com/repos/glhez/assertj-core","forks_url":"https://api.github.com/repos/glhez/assertj-core/forks","keys_url":"https://api.github.com/repos/glhez/assertj-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/glhez/assertj-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/glhez/assertj-core/teams","hooks_url":"https://api.github.com/repos/glhez/assertj-core/hooks","issue_events_url":"https://api.github.com/repos/glhez/assertj-core/issues/events{/number}","events_url":"https://api.github.com/repos/glhez/assertj-core/events","assignees_url":"https://api.github.com/repos/glhez/assertj-core/assignees{/user}","branches_url":"https://api.github.com/repos/glhez/assertj-core/branches{/branch}","tags_url":"https://api.github.com/repos/glhez/assertj-core/tags","blobs_url":"https://api.github.com/repos/glhez/assertj-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/glhez/assertj-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/glhez/assertj-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/glhez/assertj-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/glhez/assertj-core/statuses/{sha}","languages_url":"https://api.github.com/repos/glhez/assertj-core/languages","stargazers_url":"https://api.github.com/repos/glhez/assertj-core/stargazers","contributors_url":"https://api.github.com/repos/glhez/assertj-core/contributors","subscribers_url":"https://api.github.com/repos/glhez/assertj-core/subscribers","subscription_url":"https://api.github.com/repos/glhez/assertj-core/subscription","commits_url":"https://api.github.com/repos/glhez/assertj-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/glhez/assertj-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/glhez/assertj-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/glhez/assertj-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/glhez/assertj-core/contents/{+path}","compare_url":"https://api.github.com/repos/glhez/assertj-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/glhez/assertj-core/merges","archive_url":"https://api.github.com/repos/glhez/assertj-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/glhez/assertj-core/downloads","issues_url":"https://api.github.com/repos/glhez/assertj-core/issues{/number}","pulls_url":"https://api.github.com/repos/glhez/assertj-core/pulls{/number}","milestones_url":"https://api.github.com/repos/glhez/assertj-core/milestones{/number}","notifications_url":"https://api.github.com/repos/glhez/assertj-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/glhez/assertj-core/labels{/name}","releases_url":"https://api.github.com/repos/glhez/assertj-core/releases{/id}","created_at":"2015-08-05T22:18:14Z","updated_at":"2015-08-05T22:18:19Z","pushed_at":"2015-08-07T20:26:57Z","git_url":"git://github.com/glhez/assertj-core.git","ssh_url":"git@github.com:glhez/assertj-core.git","clone_url":"https://github.com/glhez/assertj-core.git","svn_url":"https://github.com/glhez/assertj-core","homepage":"","size":26203,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"joel-costigliola:java-8","ref":"java-8","sha":"095a3b9a5a3d28e9b970799d77591c1909a71372","user":{"login":"joel-costigliola","id":382613,"avatar_url":"https://avatars.githubusercontent.com/u/382613?v=3","gravatar_id":"","url":"https://api.github.com/users/joel-costigliola","html_url":"https://github.com/joel-costigliola","followers_url":"https://api.github.com/users/joel-costigliola/followers","following_url":"https://api.github.com/users/joel-costigliola/following{/other_user}","gists_url":"https://api.github.com/users/joel-costigliola/gists{/gist_id}","starred_url":"https://api.github.com/users/joel-costigliola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joel-costigliola/subscriptions","organizations_url":"https://api.github.com/users/joel-costigliola/orgs","repos_url":"https://api.github.com/users/joel-costigliola/repos","events_url":"https://api.github.com/users/joel-costigliola/events{/privacy}","received_events_url":"https://api.github.com/users/joel-costigliola/received_events","type":"User","site_admin":false},"repo":{"id":8779606,"name":"assertj-core","full_name":"joel-costigliola/assertj-core","owner":{"login":"joel-costigliola","id":382613,"avatar_url":"https://avatars.githubusercontent.com/u/382613?v=3","gravatar_id":"","url":"https://api.github.com/users/joel-costigliola","html_url":"https://github.com/joel-costigliola","followers_url":"https://api.github.com/users/joel-costigliola/followers","following_url":"https://api.github.com/users/joel-costigliola/following{/other_user}","gists_url":"https://api.github.com/users/joel-costigliola/gists{/gist_id}","starred_url":"https://api.github.com/users/joel-costigliola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joel-costigliola/subscriptions","organizations_url":"https://api.github.com/users/joel-costigliola/orgs","repos_url":"https://api.github.com/users/joel-costigliola/repos","events_url":"https://api.github.com/users/joel-costigliola/events{/privacy}","received_events_url":"https://api.github.com/users/joel-costigliola/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joel-costigliola/assertj-core","description":"AssertJ is a library of assertions similar to fest-assert but providing a richer set of assertions.","fork":false,"url":"https://api.github.com/repos/joel-costigliola/assertj-core","forks_url":"https://api.github.com/repos/joel-costigliola/assertj-core/forks","keys_url":"https://api.github.com/repos/joel-costigliola/assertj-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joel-costigliola/assertj-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joel-costigliola/assertj-core/teams","hooks_url":"https://api.github.com/repos/joel-costigliola/assertj-core/hooks","issue_events_url":"https://api.github.com/repos/joel-costigliola/assertj-core/issues/events{/number}","events_url":"https://api.github.com/repos/joel-costigliola/assertj-core/events","assignees_url":"https://api.github.com/repos/joel-costigliola/assertj-core/assignees{/user}","branches_url":"https://api.github.com/repos/joel-costigliola/assertj-core/branches{/branch}","tags_url":"https://api.github.com/repos/joel-costigliola/assertj-core/tags","blobs_url":"https://api.github.com/repos/joel-costigliola/assertj-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joel-costigliola/assertj-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joel-costigliola/assertj-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/joel-costigliola/assertj-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joel-costigliola/assertj-core/statuses/{sha}","languages_url":"https://api.github.com/repos/joel-costigliola/assertj-core/languages","stargazers_url":"https://api.github.com/repos/joel-costigliola/assertj-core/stargazers","contributors_url":"https://api.github.com/repos/joel-costigliola/assertj-core/contributors","subscribers_url":"https://api.github.com/repos/joel-costigliola/assertj-core/subscribers","subscription_url":"https://api.github.com/repos/joel-costigliola/assertj-core/subscription","commits_url":"https://api.github.com/repos/joel-costigliola/assertj-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/joel-costigliola/assertj-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/joel-costigliola/assertj-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/joel-costigliola/assertj-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/joel-costigliola/assertj-core/contents/{+path}","compare_url":"https://api.github.com/repos/joel-costigliola/assertj-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joel-costigliola/assertj-core/merges","archive_url":"https://api.github.com/repos/joel-costigliola/assertj-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joel-costigliola/assertj-core/downloads","issues_url":"https://api.github.com/repos/joel-costigliola/assertj-core/issues{/number}","pulls_url":"https://api.github.com/repos/joel-costigliola/assertj-core/pulls{/number}","milestones_url":"https://api.github.com/repos/joel-costigliola/assertj-core/milestones{/number}","notifications_url":"https://api.github.com/repos/joel-costigliola/assertj-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joel-costigliola/assertj-core/labels{/name}","releases_url":"https://api.github.com/repos/joel-costigliola/assertj-core/releases{/id}","created_at":"2013-03-14T16:18:49Z","updated_at":"2015-08-06T14:47:47Z","pushed_at":"2015-08-07T20:43:57Z","git_url":"git://github.com/joel-costigliola/assertj-core.git","ssh_url":"git@github.com:joel-costigliola/assertj-core.git","clone_url":"https://github.com/joel-costigliola/assertj-core.git","svn_url":"https://github.com/joel-costigliola/assertj-core","homepage":"","size":26203,"stargazers_count":451,"watchers_count":451,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":115,"mirror_url":null,"open_issues_count":53,"forks":115,"open_issues":53,"watchers":451,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/joel-costigliola/assertj-core/pulls/476"},"html":{"href":"https://github.com/joel-costigliola/assertj-core/pull/476"},"issue":{"href":"https://api.github.com/repos/joel-costigliola/assertj-core/issues/476"},"comments":{"href":"https://api.github.com/repos/joel-costigliola/assertj-core/issues/476/comments"},"review_comments":{"href":"https://api.github.com/repos/joel-costigliola/assertj-core/pulls/476/comments"},"review_comment":{"href":"https://api.github.com/repos/joel-costigliola/assertj-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/joel-costigliola/assertj-core/pulls/476/commits"},"statuses":{"href":"https://api.github.com/repos/joel-costigliola/assertj-core/statuses/003cb769e0f629963e77af4cf64e75468e43440b"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":144,"deletions":0,"changed_files":5}}