private Object createDummy(IMockInvocation invocation) { Class<?> type = invocation.getMethod().getReturnType(); Type genericType = invocation.getMethod().getExactReturnType(); Specification spec = invocation.getMockObject().getSpecification(); return spec.createMock("dummy", genericType, MockNature.STUB, GroovyObject.class.isAssignableFrom(type) ? MockImplementation.GROOVY : MockImplementation.JAVA, Collections.<String, Object>emptyMap(), null); } }