Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.1.7
-
None
-
None
-
OS X (my environment) and Ubuntu (coworker's environment).
Description
The attached test demonstrates the problem. The two test methods will not both succeed. Whichever one runs first will succeed and the second will fail.
I attempted to mock simple classes instead of the RestTemplate and netflix Curator classes, but was not able to duplicate the problem that way. This is some kind of weird interaction between groovy mocks and those classes.
The attached build.gradle references the versions of those spring and netflix dependencies that we use. This also fails using groovy 2.0.1, but does NOT fail under groovy 1.8.8.
In case you don't want to look at the attached code, one of these two methods will fail when called sequentially, but not when executed individually:
@Test void testOne( ) { def mockRestTemplate = new MockFor( RestTemplate ) mockRestTemplate.proxyInstance() } @Test void testTwo( ) { def mockFramework = new MockFor( CuratorFramework ) def mockReaper = new MockFor( Reaper ) def framework = mockFramework.proxyInstance() mockReaper.proxyInstance( framework ) }