{"action":"opened","issue":{"url":"https://api.github.com/repos/robfletcher/betamax/issues/160","labels_url":"https://api.github.com/repos/robfletcher/betamax/issues/160/labels{/name}","comments_url":"https://api.github.com/repos/robfletcher/betamax/issues/160/comments","events_url":"https://api.github.com/repos/robfletcher/betamax/issues/160/events","html_url":"https://github.com/robfletcher/betamax/issues/160","id":81976579,"number":160,"title":"Running JUnit Test with @FixMethodOrder(MethodSorters.NAME_ASCENDING) Causes Test Sequential Tests to Fail","user":{"login":"davidwesst","id":867084,"avatar_url":"https://avatars.githubusercontent.com/u/867084?v=3","gravatar_id":"","url":"https://api.github.com/users/davidwesst","html_url":"https://github.com/davidwesst","followers_url":"https://api.github.com/users/davidwesst/followers","following_url":"https://api.github.com/users/davidwesst/following{/other_user}","gists_url":"https://api.github.com/users/davidwesst/gists{/gist_id}","starred_url":"https://api.github.com/users/davidwesst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidwesst/subscriptions","organizations_url":"https://api.github.com/users/davidwesst/orgs","repos_url":"https://api.github.com/users/davidwesst/repos","events_url":"https://api.github.com/users/davidwesst/events{/privacy}","received_events_url":"https://api.github.com/users/davidwesst/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-28T15:14:55Z","updated_at":"2015-05-28T15:14:55Z","closed_at":null,"body":"I've hit and resolved a strange behavior while writing JUnit tests using Java 6 and requiring a downgrade Groovy to 2.2.2 for [compatibility](https://github.com/robfletcher/betamax/issues/141).\r\n\r\nI found that when I ran a TestClass with the @FixMethodOrder(MethodSorters.NAME_ASCENDING) annotation on the class, the first Betamax test would run, but the remaining tests would all fail with a NullPointerException (see example stack trace).\r\n\r\nWhen run individually, they would run just fine and record/load tapes as expected.\r\n\r\nTo resolve the issue, I removed the @FixMethodOrder annotation and all works as expected!\r\n\r\nI'm not sure if this is expected behavior, but being so new to the framework and Java/Groovy world in general, I figured I'd document the issue here for others, or possibly someone to explain.\r\n\r\n---\r\n```\r\njava.lang.NullPointerException\r\n\tat ca.umanitoba.alma.model.AlmaUser.createFromDTO(AlmaUser.java:66)\r\n\tat ca.umanitoba.alma.AlmaRESTApiClient.getUserInfo(AlmaRESTApiClient.java:115)\r\n\tat ca.umanitoba.alma.AlmaRESTApiClientTest.getUserInfo_ShouldReturnUserWithProvidedIDIfFound(AlmaRESTApiClientTest.java:332)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n\tat java.lang.reflect.Method.invoke(Method.java:597)\r\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)\r\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\r\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)\r\n\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\r\n\tat org.junit.internal.runners.statements.InvokeMethod$evaluate.call(Unknown Source)\r\n\tat co.freeside.betamax.Recorder$_1_evaluate_closure1.doCall(Recorder.groovy:186)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n\tat java.lang.reflect.Method.invoke(Method.java:597)\r\n\tat org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)\r\n\tat groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)\r\n\tat org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)\r\n\tat groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)\r\n\tat org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)\r\n\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)\r\n\tat co.freeside.betamax.Recorder$_1_evaluate_closure1.doCall(Recorder.groovy)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n\tat java.lang.reflect.Method.invoke(Method.java:597)\r\n\tat org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)\r\n\tat groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)\r\n\tat org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)\r\n\tat groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)\r\n\tat org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)\r\n\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)\r\n\tat co.freeside.betamax.Recorder.withTape(Recorder.groovy:168)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n\tat java.lang.reflect.Method.invoke(Method.java:597)\r\n\tat org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)\r\n\tat groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)\r\n\tat groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)\r\n\tat org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:78)\r\n\tat co.freeside.betamax.Recorder.this$dist$invoke$2(Recorder.groovy)\r\n\tat co.freeside.betamax.Recorder$1.methodMissing(Recorder.groovy)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n\tat java.lang.reflect.Method.invoke(Method.java:597)\r\n\tat org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)\r\n\tat groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:837)\r\n\tat groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1134)\r\n\tat groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1087)\r\n\tat groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)\r\n\tat org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)\r\n\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)\r\n\tat co.freeside.betamax.Recorder$1.evaluate(Recorder.groovy:185)\r\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\r\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n\tat org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)\r\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n\tat org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)\r\n\tat org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)\r\n```\r\n"}}