{"action":"created","issue":{"url":"https://api.github.com/repos/sbrannen/spring-test-junit5/issues/5","repository_url":"https://api.github.com/repos/sbrannen/spring-test-junit5","labels_url":"https://api.github.com/repos/sbrannen/spring-test-junit5/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/sbrannen/spring-test-junit5/issues/5/comments","events_url":"https://api.github.com/repos/sbrannen/spring-test-junit5/issues/5/events","html_url":"https://github.com/sbrannen/spring-test-junit5/issues/5","id":156578456,"number":5,"title":"Spring-Enabled Extensions ","user":{"login":"mmichaelis","id":71911,"avatar_url":"https://avatars.githubusercontent.com/u/71911?v=3","gravatar_id":"","url":"https://api.github.com/users/mmichaelis","html_url":"https://github.com/mmichaelis","followers_url":"https://api.github.com/users/mmichaelis/followers","following_url":"https://api.github.com/users/mmichaelis/following{/other_user}","gists_url":"https://api.github.com/users/mmichaelis/gists{/gist_id}","starred_url":"https://api.github.com/users/mmichaelis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmichaelis/subscriptions","organizations_url":"https://api.github.com/users/mmichaelis/orgs","repos_url":"https://api.github.com/users/mmichaelis/repos","events_url":"https://api.github.com/users/mmichaelis/events{/privacy}","received_events_url":"https://api.github.com/users/mmichaelis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-24T18:34:10Z","updated_at":"2016-05-25T21:22:41Z","closed_at":null,"body":"In our project we use JUnit4 Rules with autowired fields. You can achieve this by having a Rule-Bean which then gets added to the test via autowiring:\r\n\r\n```java\r\npublic class MyTest() {\r\n  @Rule\r\n  @Autowired\r\n  public TestRule myRule;\r\n}\r\n```\r\n\r\nThis works like charm - except for ClassRules.\r\n\r\nNow it would be interesting if spring-test-junit5 enables this approach for Extensions.\r\n\r\nI assume that the `org.junit.gen5.engine.junit5.extension.ExtensionRegistry` needs to be adopted in `registerExtension` in some way. The problem I see: each new test context requires its own Spring enabled extensions.\r\n\r\nAny ideas?"},"comment":{"url":"https://api.github.com/repos/sbrannen/spring-test-junit5/issues/comments/221711695","html_url":"https://github.com/sbrannen/spring-test-junit5/issues/5#issuecomment-221711695","issue_url":"https://api.github.com/repos/sbrannen/spring-test-junit5/issues/5","id":221711695,"user":{"login":"mmichaelis","id":71911,"avatar_url":"https://avatars.githubusercontent.com/u/71911?v=3","gravatar_id":"","url":"https://api.github.com/users/mmichaelis","html_url":"https://github.com/mmichaelis","followers_url":"https://api.github.com/users/mmichaelis/followers","following_url":"https://api.github.com/users/mmichaelis/following{/other_user}","gists_url":"https://api.github.com/users/mmichaelis/gists{/gist_id}","starred_url":"https://api.github.com/users/mmichaelis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmichaelis/subscriptions","organizations_url":"https://api.github.com/users/mmichaelis/orgs","repos_url":"https://api.github.com/users/mmichaelis/repos","events_url":"https://api.github.com/users/mmichaelis/events{/privacy}","received_events_url":"https://api.github.com/users/mmichaelis/received_events","type":"User","site_admin":false},"created_at":"2016-05-25T21:22:41Z","updated_at":"2016-05-25T21:22:41Z","body":"Well... I'll give it a try. But my first approach will be to test my idea to extend the SpringExtension. The rough sketch goes like this:\r\n\r\n1. have an annotation `SpringExtendWith` just like `ExtendWith`\r\n2. create a derived class of `SpringExtension` named `SpringExtensibleExtension` (actually my idea might directly go into `SpringExtension` but I will try with a derived class first)\r\n3. now in `beforeAll` first let `SpringExtension` create the test context\r\n4. then search for all annotations `SpringExtendWith`\r\n5. let the application context create the extension bean\r\n5. register all instantiated and found extensions bound to the testclass (just as the test context manager)\r\n6. in `beforeAll` and all other callbacks call the relevant callback\r\n\r\nChallenges:\r\n* What to do with multiple exceptions caught while performing the callbacks (possibly throw a dedicated exception in this case)?\r\n* Also respect annotations at methods not only types.\r\n* See if it would not be better to make the ExtensionRegistry from JUnit5 reusable in some way as the approach is similar.\r\n* Challenge for me: Understand the hierarchy-concept of ExtensionRegistries... do we need a similar approach?\r\n\r\nHopefully I have a PoC in the next days. Or do you see any challenges I did not detect yet?"}}
{"actor":{"display_login":"mmichaelis"}}