Hello!
I was using mockito with specs and ran into an issue with verifying no invocations on a mock. I was trying to figure out how to verify zero interactions with a mock, so tried a "there was no(uselessMock)" call in one of my examples. Strangely, the example with this code passes, but the next example fails with a cryptic PathException that halts all remaining example runs. I would expect an error in one example to be isolated and not pollute subsequent example test runs.
Code below followed by stack trace at the bottom.
Thanks!
Mike
import org.specs.SpecificationWithJUnit
import org.specs.mock.Mockito
class ListSpec extends SpecificationWithJUnit with Mockito {
"MyList" should {
// actual type of Mock doesn't matter
val uselessMock = mock[List[Int]]
"test" in {
there was no(uselessMock)(any)
}
"test again" in {
there was no(uselessMock)
}
"test last time" in {
there was no(uselessMock)(any)
}
}
}
org.specs.specification.PathException: TreePath(List(0, 0, 2))not found for test last time
at org.specs.specification.SpecificationExecutor$class.executeExample(SpecificationExecutor.scala:51)
at org.specs.specification.BaseSpecification.executeExample(BaseSpecification.scala:58)
at org.specs.specification.BaseSpecification.executeExample(BaseSpecification.scala:58)
at org.specs.specification.ExampleLifeCycle$$anonfun$executeExample$1.apply(ExampleLifeCycle.scala:125)
at org.specs.specification.ExampleLifeCycle$$anonfun$executeExample$1.apply(ExampleLifeCycle.scala:125)
at scala.Option.map(Option.scala:133)
at org.specs.specification.ExampleLifeCycle$class.executeExample(ExampleLifeCycle.scala:125)
at org.specs.specification.Examples.executeExample(Examples.scala:52)
at org.specs.specification.Examples.executeExample(Examples.scala:52)
at org.specs.specification.Examples$$anonfun$executeExamples$2.apply(Examples.scala:80)
at org.specs.specification.Examples$$anonfun$executeExamples$2.apply(Examples.scala:80)
at scala.Option.map(Option.scala:133)
at org.specs.specification.Examples.executeExamples(Examples.scala:80)
at org.specs.specification.ExampleStructure$class.ownSkipped(ExampleStructure.scala:60)
at org.specs.specification.Examples.ownSkipped(Examples.scala:52)
at org.specs.runner.ExampleTestCase.run(JUnit.scala:205)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.specs.runner.JUnitSuite$class.run(JUnit.scala:62)
at org.specs.runner.ExamplesTestSuite.run(JUnit.scala:167)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.specs.runner.JUnitSuite$class.run(JUnit.scala:62)
at org.specs.SpecificationWithJUnit.run(SpecificationWithJUnit.scala:29)
at org.specs.runner.JUnitSuiteRunner.run(JUnitSuiteRunner.scala:45)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)