use of org.spockframework.mock.runtime.DynamicProxyMockInterceptorAdapter in project spock by spockframework.
the class DynamicProxyMockFactory method createMock.
static Object createMock(Class<?> mockType, List<Class<?>> additionalInterfaces, List<Object> constructorArgs, IProxyBasedMockInterceptor mockInterceptor, ClassLoader classLoader) {
if (constructorArgs != null) {
throw new InvalidSpecException("Interface based mocks may not have constructor arguments");
}
List<Class<?>> interfaces = new ArrayList<>();
interfaces.add(mockType);
interfaces.addAll(additionalInterfaces);
interfaces.add(ISpockMockObject.class);
return Proxy.newProxyInstance(classLoader, interfaces.toArray(CLASSES), new DynamicProxyMockInterceptorAdapter(mockInterceptor));
}
Aggregations