{"action":"created","issue":{"url":"https://api.github.com/repos/junit-team/junit-lambda/issues/64","labels_url":"https://api.github.com/repos/junit-team/junit-lambda/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/junit-team/junit-lambda/issues/64/comments","events_url":"https://api.github.com/repos/junit-team/junit-lambda/issues/64/events","html_url":"https://github.com/junit-team/junit-lambda/issues/64","id":121943448,"number":64,"title":"ReflectionUtils.handleException() should not wrap a target exception in an IllegalStateException","user":{"login":"jlink","id":103937,"avatar_url":"https://avatars.githubusercontent.com/u/103937?v=3","gravatar_id":"","url":"https://api.github.com/users/jlink","html_url":"https://github.com/jlink","followers_url":"https://api.github.com/users/jlink/followers","following_url":"https://api.github.com/users/jlink/following{/other_user}","gists_url":"https://api.github.com/users/jlink/gists{/gist_id}","starred_url":"https://api.github.com/users/jlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlink/subscriptions","organizations_url":"https://api.github.com/users/jlink/orgs","repos_url":"https://api.github.com/users/jlink/repos","events_url":"https://api.github.com/users/jlink/events{/privacy}","received_events_url":"https://api.github.com/users/jlink/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"sbrannen","id":104798,"avatar_url":"https://avatars.githubusercontent.com/u/104798?v=3","gravatar_id":"","url":"https://api.github.com/users/sbrannen","html_url":"https://github.com/sbrannen","followers_url":"https://api.github.com/users/sbrannen/followers","following_url":"https://api.github.com/users/sbrannen/following{/other_user}","gists_url":"https://api.github.com/users/sbrannen/gists{/gist_id}","starred_url":"https://api.github.com/users/sbrannen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbrannen/subscriptions","organizations_url":"https://api.github.com/users/sbrannen/orgs","repos_url":"https://api.github.com/users/sbrannen/repos","events_url":"https://api.github.com/users/sbrannen/events{/privacy}","received_events_url":"https://api.github.com/users/sbrannen/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/junit-team/junit-lambda/milestones/1","html_url":"https://github.com/junit-team/junit-lambda/milestones/Alpha%201","labels_url":"https://api.github.com/repos/junit-team/junit-lambda/milestones/1/labels","id":1439662,"number":1,"title":"Alpha 1","description":"","creator":{"login":"marcphilipp","id":214207,"avatar_url":"https://avatars.githubusercontent.com/u/214207?v=3","gravatar_id":"","url":"https://api.github.com/users/marcphilipp","html_url":"https://github.com/marcphilipp","followers_url":"https://api.github.com/users/marcphilipp/followers","following_url":"https://api.github.com/users/marcphilipp/following{/other_user}","gists_url":"https://api.github.com/users/marcphilipp/gists{/gist_id}","starred_url":"https://api.github.com/users/marcphilipp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcphilipp/subscriptions","organizations_url":"https://api.github.com/users/marcphilipp/orgs","repos_url":"https://api.github.com/users/marcphilipp/repos","events_url":"https://api.github.com/users/marcphilipp/events{/privacy}","received_events_url":"https://api.github.com/users/marcphilipp/received_events","type":"User","site_admin":false},"open_issues":19,"closed_issues":17,"state":"open","created_at":"2015-12-02T14:19:41Z","updated_at":"2015-12-18T10:11:23Z","due_on":"2016-01-28T23:00:00Z","closed_at":null},"comments":4,"created_at":"2015-12-13T21:02:20Z","updated_at":"2015-12-18T12:01:15Z","closed_at":null,"body":"## Status Quo\r\n\r\nThe `handleException()` method in `ReflectionUtils` currently extracts a _target exception_ from an `InvocationTargetException`, and if the _target exception_ is a checked `Exception` it will be wrapped in an `IllegalStateException` with the message `\"Unhandled exception\"`.\r\n\r\nThis behavior, however, is inappropriate for a testing framework that reflectively invokes test methods.\r\n\r\nSpecifically, any exception thrown by a test method must be reported in `TestExecutionResult`. If such an exception is wrapped in an `IllegalStateException`, that makes it very difficult to _retrieve_ the original exception, since it is impossible to know that some `IllegalStateExceptions` should be treated differently than others.\r\n\r\n## Analysis\r\n\r\nWe do not want to have to reason about the contents of an `IllegalStateException`. Instead, we need an explicit way to retrieve an exception thrown by a test method.\r\n\r\n## Deliverables\r\n\r\n- [ ] Introduce a custom `RuntimeException` for wrapping checked exceptions that are thrown when reflectively invoking test methods.\r\n- [ ] Refactor `ReflectionUtils.handleException()` accordingly.\r\n- [ ] Refactor `HierarchicalTestEngine` and its collaborators so that this new `RuntimeException` is properly processed."},"comment":{"url":"https://api.github.com/repos/junit-team/junit-lambda/issues/comments/165763810","html_url":"https://github.com/junit-team/junit-lambda/issues/64#issuecomment-165763810","issue_url":"https://api.github.com/repos/junit-team/junit-lambda/issues/64","id":165763810,"user":{"login":"jlink","id":103937,"avatar_url":"https://avatars.githubusercontent.com/u/103937?v=3","gravatar_id":"","url":"https://api.github.com/users/jlink","html_url":"https://github.com/jlink","followers_url":"https://api.github.com/users/jlink/followers","following_url":"https://api.github.com/users/jlink/following{/other_user}","gists_url":"https://api.github.com/users/jlink/gists{/gist_id}","starred_url":"https://api.github.com/users/jlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlink/subscriptions","organizations_url":"https://api.github.com/users/jlink/orgs","repos_url":"https://api.github.com/users/jlink/repos","events_url":"https://api.github.com/users/jlink/events{/privacy}","received_events_url":"https://api.github.com/users/jlink/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T12:01:15Z","updated_at":"2015-12-18T12:01:15Z","body":"What's the problem with a checked exception? If we have to catch exceptions when calling invoke anyway, we could even throw Throwsble...\n\n> Am 18.12.2015 um 12:07 schrieb Sam Brannen <notifications@github.com>:\n> \n> Thanks for raising this issue.\n> \n> I've been aware of it for quite some time; I just didn't get around to creating a ticket for it.\n> \n> We actually do not want to propagate an InvocationTargetException since it is a checked exception. Instead, we should wrap either the InvocationTargetException or its _target exceptionin a customRuntimeException` that we can then correctly handle higher up the call stack.\n> \n> —\n> Reply to this email directly or view it on GitHub.\n> \n"}}