jtanistra / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

http://meetspock.appspot.com: Mocking of non-interface not supported #346

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When I tried to run the following test 
(http://meetspock.appspot.com/script/5741031244955648) I got an error:

%%%
FilesystemImagePersistenceStrategyTest
 - save() should gives proper name to the file   FAILED

   org.spockframework.mock.CannotCreateMockException: Cannot create mock for class FilesystemImagePersistenceStrategy. Mocking of non-interface types requires the CGLIB library. Please put cglib-nodep-2.2 or higher on the class path.
   at org.spockframework.mock.runtime.ProxyBasedMockFactory.create(ProxyBasedMockFactory.java:52)
   at org.spockframework.mock.runtime.JavaMockFactory.create(JavaMockFactory.java:51)
   at org.spockframework.mock.runtime.CompositeMockFactory.create(CompositeMockFactory.java:44)
   at org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:45)
   at org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:281)
   at org.spockframework.lang.SpecInternals.SpyImpl(SpecInternals.java:163)
   at FilesystemImagePersistenceStrategyTest.$spock_initializeFields(Script1.groovy:25)
%%%

So, looks like it's a bug.

Original issue reported on code.google.com by slava.se...@gmail.com on 4 Feb 2014 at 8:26

GoogleCodeExporter commented 8 years ago
Spock web console doesn't support stubbing/mocking/spying for classes (only for 
interfaces).

Original comment by pnied...@gmail.com on 4 Feb 2014 at 8:50