本文整理汇总了Java中org.mockito.MockSettings.serializable方法的典型用法代码示例。如果您正苦于以下问题:Java MockSettings.serializable方法的具体用法?Java MockSettings.serializable怎么用?Java MockSettings.serializable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mockito.MockSettings
的用法示例。
在下文中一共展示了MockSettings.serializable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import org.mockito.MockSettings; //导入方法依赖的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.MockSettings; //导入方法依赖的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: createMock
import org.mockito.MockSettings; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public <T> T createMock(String name) {
MockSettings settings = MockReset.withSettings(getReset());
if (StringUtils.hasLength(name)) {
settings.name(name);
}
if (!this.extraInterfaces.isEmpty()) {
settings.extraInterfaces(this.extraInterfaces.toArray(new Class<?>[] {}));
}
settings.defaultAnswer(getAnswer(this.answer));
if (this.serializable) {
settings.serializable();
}
return (T) Mockito.mock(this.classToMock, settings);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:MockDefinition.java
示例4: createMock
import org.mockito.MockSettings; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public <T> T createMock(String name) {
MockSettings settings = MockReset.withSettings(getReset());
if (StringUtils.hasLength(name)) {
settings.name(name);
}
if (!this.extraInterfaces.isEmpty()) {
settings.extraInterfaces(this.extraInterfaces.toArray(new Class<?>[] {}));
}
settings.defaultAnswer(this.answer.get());
if (this.serializable) {
settings.serializable();
}
return (T) Mockito.mock(this.classToMock, settings);
}
示例5: apply
import org.mockito.MockSettings; //导入方法依赖的package包/类
@Override
public MockSettings apply(MockSettings mockSettings) {
return mockSettings.serializable(serializableMode);
}