本文整理汇总了Java中org.mockito.Mock.extraInterfaces方法的典型用法代码示例。如果您正苦于以下问题:Java Mock.extraInterfaces方法的具体用法?Java Mock.extraInterfaces怎么用?Java Mock.extraInterfaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mockito.Mock
的用法示例。
在下文中一共展示了Mock.extraInterfaces方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import org.mockito.Mock; //导入方法依赖的package包/类
public Object process(Mock annotation, Field field) {
MockSettings mockSettings = Mockito.withSettings();
if (annotation.extraInterfaces().length > 0) { // never null
mockSettings.extraInterfaces(annotation.extraInterfaces());
}
if ("".equals(annotation.name())) {
mockSettings.name(field.getName());
} else {
mockSettings.name(annotation.name());
}
if(annotation.serializable()){
mockSettings.serializable();
}
// see @Mock answer default value
mockSettings.defaultAnswer(annotation.answer().get());
return Mockito.mock(field.getType(), mockSettings);
}
示例2: getParameterValue
import org.mockito.Mock; //导入方法依赖的package包/类
@Override
public Object getParameterValue(Parameter parameter) {
Mock annotation = parameter.getAnnotation(Mock.class);
MockSettings settings = Mockito.withSettings();
if (annotation.extraInterfaces().length > 0) {
settings.extraInterfaces(annotation.extraInterfaces());
}
if (annotation.serializable()) {
settings.serializable();
}
settings.name(annotation.name().isEmpty() ? parameter.getName() : annotation.name());
settings.defaultAnswer(annotation.answer());
return Mockito.mock(parameter.getType(), settings);
}
示例3: processAnnotationOn
import org.mockito.Mock; //导入方法依赖的package包/类
private Object processAnnotationOn(Mock annotation, Field field) {
MockSettings mockSettings = Mockito.withSettings();
if (annotation.extraInterfaces().length > 0) { // never null
mockSettings.extraInterfaces(annotation.extraInterfaces());
}
if ("".equals(annotation.name())) {
mockSettings.name(field.getName());
} else {
mockSettings.name(annotation.name());
}
// see @Mock answer default value
mockSettings.defaultAnswer(annotation.answer().get());
return Mockito.mock(field.getType(), mockSettings);
}