Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.0 final
-
Fix Version/s: None
-
Component/s: Testing
-
Labels:None
Description
The following test will break:
@TestFor(MyService)
class MyServiceTests {
void testSomething() {
def mockControl = mockFor(Object),
myMock = mockControl.createMock()
assert true
}
}
I wanted to mock this: http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.html
But it required an argument for the constructor and the Grails mocking framework doesn't support supplying those arguments. So I decided for using a generic Object as I only wanted to test the arguments passed to the request() method.
Here is some output:
...
at grails.test.GrailsMock$_createMock_closure1.doCall(GrailsMock.groovy:103)
at grails.test.GrailsMock$_createMock_closure1.doCall(GrailsMock.groovy:103)
Failure: null
| java.lang.StackOverflowError
at java.lang.Thread.getId(Thread.java:1623)
at java.util.concurrent.locks.ReentrantReadWriteLock$Sync.tryReleaseShared(ReentrantReadWriteLock.java:360)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1317)
at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.unlock(ReentrantReadWriteLock.java:745)
at grails.test.GrailsMock$_createMock_closure1.doCall(GrailsMock.groovy:103)
at grails.test.GrailsMock$_createMock_closure1.doCall(GrailsMock.groovy:103)
at grails.test.GrailsMock$_createMock_closure1.doCall(GrailsMock.groovy:103)
at grails.test.GrailsMock$_createMock_closure1.doCall(GrailsMock.groovy:103)
...
Sorry about the formatting, couldn't find how to change the description after the bug was created.