{"action":"created","issue":{"url":"https://api.github.com/repos/spockframework/spock/issues/575","repository_url":"https://api.github.com/repos/spockframework/spock","labels_url":"https://api.github.com/repos/spockframework/spock/issues/575/labels{/name}","comments_url":"https://api.github.com/repos/spockframework/spock/issues/575/comments","events_url":"https://api.github.com/repos/spockframework/spock/issues/575/events","html_url":"https://github.com/spockframework/spock/pull/575","id":144142104,"number":575,"title":"Fix support for Spring 2.5 and Spring 3 on Spock Spring 1.1-SNAPSHOT.","user":{"login":"egrajeda","id":12800,"avatar_url":"https://avatars.githubusercontent.com/u/12800?v=3","gravatar_id":"","url":"https://api.github.com/users/egrajeda","html_url":"https://github.com/egrajeda","followers_url":"https://api.github.com/users/egrajeda/followers","following_url":"https://api.github.com/users/egrajeda/following{/other_user}","gists_url":"https://api.github.com/users/egrajeda/gists{/gist_id}","starred_url":"https://api.github.com/users/egrajeda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egrajeda/subscriptions","organizations_url":"https://api.github.com/users/egrajeda/orgs","repos_url":"https://api.github.com/users/egrajeda/repos","events_url":"https://api.github.com/users/egrajeda/events{/privacy}","received_events_url":"https://api.github.com/users/egrajeda/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-03-29T03:04:34Z","updated_at":"2016-10-14T01:33:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/spockframework/spock/pulls/575","html_url":"https://github.com/spockframework/spock/pull/575","diff_url":"https://github.com/spockframework/spock/pull/575.diff","patch_url":"https://github.com/spockframework/spock/pull/575.patch"},"body":"The current `spock-spring-1.1-SNAPSHOT` throws an `IncompatibleClassChangeError` when being used with Spring 2.5 or Spring 3, caused by `TestContext` changing [from a class](http://docs.spring.io/spring/docs/3.2.16.RELEASE/javadoc-api/org/springframework/test/context/TestContext.html) to an [interface on Spring 4](http://docs.spring.io/spring/docs/4.1.0.RELEASE/javadoc-api/org/springframework/test/context/TestContext.html):\r\n\r\n```\r\njava.lang.IncompatibleClassChangeError: Found class org.springframework.test.context.TestContext, but interface was expected\r\n\tat org.spockframework.spring.SpringMockTestExecutionListener.beforeTestMethod(SpringMockTestExecutionListener.java:35)\r\n\tat org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:292)\r\n\tat org.spockframework.spring.SpringTestContextManager.beforeTestMethod(SpringTestContextManager.java:54)\r\n\tat org.spockframework.spring.SpringInterceptor.interceptSetupMethod(SpringInterceptor.java:45)\r\n\tat org.spockframework.runtime.extension.AbstractMethodInterceptor.intercept(AbstractMethodInterceptor.java:28)\r\n```\r\n\r\nAfter some investigation I found out it started to happen after #546 was merged. It introduced `SpringMockTestExecutionListener` which uses `TestContext`, and by doing so (I think) causes the interface signature to be shipped with the library, triggering the conflict with previous versions of Spring.\r\n\r\nThe fix I suggest uses a similar approach used for `SpringTestContextManager`, wrapping `TestContext` inside a new class called `SpringTestContext` which uses reflection to invoke the methods.\r\n\r\nI've also added two simple tests for Spring 2.5 and Spring 3 which should fail if some other class incompatibility error is introduced."},"comment":{"url":"https://api.github.com/repos/spockframework/spock/issues/comments/253686534","html_url":"https://github.com/spockframework/spock/pull/575#issuecomment-253686534","issue_url":"https://api.github.com/repos/spockframework/spock/issues/575","id":253686534,"user":{"login":"egrajeda","id":12800,"avatar_url":"https://avatars.githubusercontent.com/u/12800?v=3","gravatar_id":"","url":"https://api.github.com/users/egrajeda","html_url":"https://github.com/egrajeda","followers_url":"https://api.github.com/users/egrajeda/followers","following_url":"https://api.github.com/users/egrajeda/following{/other_user}","gists_url":"https://api.github.com/users/egrajeda/gists{/gist_id}","starred_url":"https://api.github.com/users/egrajeda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egrajeda/subscriptions","organizations_url":"https://api.github.com/users/egrajeda/orgs","repos_url":"https://api.github.com/users/egrajeda/repos","events_url":"https://api.github.com/users/egrajeda/events{/privacy}","received_events_url":"https://api.github.com/users/egrajeda/received_events","type":"User","site_admin":false},"created_at":"2016-10-14T01:33:45Z","updated_at":"2016-10-14T01:33:45Z","body":"Hey @leonard84, any chance of this getting merged? Have been running tests with these changes for over half a year now and everything seems in order. Let me know if you would like me to make any changes."}}
{"actor":{"display_login":"egrajeda"}}