本文整理汇总了Java中org.mockito.invocation.MockHandler类的典型用法代码示例。如果您正苦于以下问题:Java MockHandler类的具体用法?Java MockHandler怎么用?Java MockHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MockHandler类属于org.mockito.invocation包,在下文中一共展示了MockHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addAnswersForStubbing
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void addAnswersForStubbing(MockitoMethodInvocationControl invocationControl) {
final MockHandler mockHandler = invocationControl.getInvocationHandler().getHandler();
final List list = Whitebox.getInternalState(this, List.class);
try {
Whitebox.invokeMethod(mockHandler, "setAnswersForStubbing", list);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:awenblue,项目名称:powermock,代码行数:11,代码来源:PowerMockitoStubberImpl.java
示例2: getHandler
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public MockHandler getHandler(Object mock) {
// Return a fake mock handler for static method mocks
if(mock instanceof Class) {
return new PowerMockInternalMockHandler((Class<?>) mock);
} else {
return cglibMockMaker.getHandler(mock);
}
}
开发者ID:awenblue,项目名称:powermock,代码行数:9,代码来源:PowerMockMaker.java
示例3: replaceMatchersBinderIfNeeded
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
private MockHandler replaceMatchersBinderIfNeeded(MockHandler mockHandler) {
if(!Whitebox.getFieldsOfType(mockHandler, MatchersBinder.class).isEmpty()) {
Whitebox.setInternalState(mockHandler, new PowerMockMatchersBinder());
} else if(!Whitebox.getFieldsOfType(mockHandler, InternalMockHandler.class).isEmpty()) {
final MockHandler internalMockHandler = Whitebox.getInternalState(mockHandler, MockHandler.class);
return replaceMatchersBinderIfNeeded(internalMockHandler);
}
return mockHandler;
}
开发者ID:awenblue,项目名称:powermock,代码行数:10,代码来源:MockitoMethodInvocationControl.java
示例4: cast
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
private InternalMockHandler cast(MockHandler handler) {
if (!(handler instanceof InternalMockHandler)) {
throw new MockitoException("At the moment you cannot provide own implementations of MockHandler." +
"\nPlease see the javadocs for the MockMaker interface.");
}
return (InternalMockHandler) handler;
}
开发者ID:mockito,项目名称:mockito-cglib,代码行数:8,代码来源:CglibMockMaker.java
示例5: getHandler
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public MockHandler getHandler(Object mock) {
if (!(mock instanceof Factory)) {
return null;
}
Factory factory = (Factory) mock;
Callback callback = factory.getCallback(0);
if (!(callback instanceof MethodInterceptorFilter)) {
return null;
}
return ((MethodInterceptorFilter) callback).getHandler();
}
开发者ID:mockito,项目名称:mockito-cglib,代码行数:12,代码来源:CglibMockMaker.java
示例6: createMock
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public <T> T createMock(MockCreationSettings<T> settings) {
MockHandler mockHandler = new MockHandlerFactory().create(settings);
T mock = mockMaker.createMock(settings, mockHandler);
Object spiedInstance = settings.getSpiedInstance();
if (spiedInstance != null) {
new LenientCopyTool().copyToMock(spiedInstance, mock);
}
return mock;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:MockUtil.java
示例7: resetMock
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public <T> void resetMock(T mock) {
InternalMockHandler oldHandler = (InternalMockHandler) getMockHandler(mock);
MockCreationSettings settings = oldHandler.getMockSettings();
MockHandler newHandler = new MockHandlerFactory().create(settings);
mockMaker.resetMock(mock, newHandler, settings);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:MockUtil.java
示例8: getMockHandler
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public <T> InternalMockHandler<T> getMockHandler(T mock) {
if (mock == null) {
throw new NotAMockException("Argument should be a mock, but is null!");
}
if (isMockitoMock(mock)) {
MockHandler handler = mockMaker.getHandler(mock);
return (InternalMockHandler) handler;
} else {
throw new NotAMockException("Argument should be a mock, but is: " + mock.getClass());
}
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:MockUtil.java
示例9: resetMock
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
@Override
public void resetMock(Object mock, MockHandler newHandler, MockCreationSettings settings) {
InvocationHandlerAdapter adapter = getInvocationHandlerAdapter(mock);
if (adapter != null) {
adapter.setHandler(newHandler);
}
}
开发者ID:linkedin,项目名称:dexmaker,代码行数:8,代码来源:InlineDexmakerMockMaker.java
示例10: createMock
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public <T> T createMock(MockCreationSettings<T> settings, MockHandler handler) {
return cglibMockMaker.createMock(settings, handler);
}
开发者ID:awenblue,项目名称:powermock,代码行数:4,代码来源:PowerMockMaker.java
示例11: resetMock
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public void resetMock(Object mock, MockHandler newHandler, MockCreationSettings settings) {
cglibMockMaker.resetMock(mock, newHandler, settings);
}
开发者ID:awenblue,项目名称:powermock,代码行数:4,代码来源:PowerMockMaker.java
示例12: getHandler
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public MockHandler getHandler() {
return handler;
}
开发者ID:mockito,项目名称:mockito-cglib,代码行数:4,代码来源:MethodInterceptorFilter.java
示例13: createMock
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public <T> T createMock(MockCreationSettings<T> settings, MockHandler handler) {
InternalMockHandler mockitoHandler = cast(handler);
new AcrossJVMSerializationFeature().enableSerializationAcrossJVM(settings);
return new ClassImposterizer(new InstantiatorProvider().getInstantiator(settings)).imposterise(
new MethodInterceptorFilter(mockitoHandler, settings), settings.getTypeToMock(), settings.getExtraInterfaces());
}
开发者ID:mockito,项目名称:mockito-cglib,代码行数:7,代码来源:CglibMockMaker.java
示例14: resetMock
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public void resetMock(Object mock, MockHandler newHandler, MockCreationSettings settings) {
((Factory) mock).setCallback(0, new MethodInterceptorFilter(cast(newHandler), settings));
}
开发者ID:mockito,项目名称:mockito-cglib,代码行数:4,代码来源:CglibMockMaker.java
示例15: InvocationHandlerAdapter
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public InvocationHandlerAdapter(MockHandler handler) {
this.handler = handler;
}
开发者ID:Sellegit,项目名称:j2objc,代码行数:4,代码来源:InvocationHandlerAdapter.java
示例16: getHandler
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public MockHandler getHandler() {
return handler;
}
开发者ID:Sellegit,项目名称:j2objc,代码行数:4,代码来源:InvocationHandlerAdapter.java
示例17: setHandler
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public void setHandler(MockHandler handler) {
this.handler = handler;
}
开发者ID:Sellegit,项目名称:j2objc,代码行数:4,代码来源:InvocationHandlerAdapter.java
示例18: getHandler
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
@Override
public MockHandler getHandler(Object mock) {
InvocationHandlerAdapter adapter = getInvocationHandlerAdapter(mock);
return adapter != null ? adapter.getHandler() : null;
}
开发者ID:Sellegit,项目名称:j2objc,代码行数:6,代码来源:IosMockMaker.java
示例19: resetMock
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public void resetMock(Object mock, MockHandler newHandler, MockCreationSettings settings) {
InvocationHandlerAdapter adapter = getInvocationHandlerAdapter(mock);
adapter.setHandler(newHandler);
}
开发者ID:Sellegit,项目名称:j2objc,代码行数:7,代码来源:IosMockMaker.java
示例20: createMock
import org.mockito.invocation.MockHandler; //导入依赖的package包/类
public <T> T createMock(MockCreationSettings<T> settings, MockHandler handler) {
InternalMockHandler mockitoHandler = cast(handler);
new AcrossJVMSerializationFeature().enableSerializationAcrossJVM(settings);
return ClassImposterizer.INSTANCE.imposterise(
new MethodInterceptorFilter(mockitoHandler, settings), settings.getTypeToMock(), settings.getExtraInterfaces());
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:7,代码来源:CglibMockMaker.java
注:本文中的org.mockito.invocation.MockHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论