本文整理汇总了Java中org.mockito.MockitoAnnotations.initMocks方法的典型用法代码示例。如果您正苦于以下问题:Java MockitoAnnotations.initMocks方法的具体用法?Java MockitoAnnotations.initMocks怎么用?Java MockitoAnnotations.initMocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mockito.MockitoAnnotations
的用法示例。
在下文中一共展示了MockitoAnnotations.initMocks方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setUp() throws PackageManager.NameNotFoundException {
MockitoAnnotations.initMocks(this);
applicationInfo = new ApplicationInfo();
applicationInfo.metaData = new Bundle();
String packageName = "com.bumptech.test";
when(context.getPackageName()).thenReturn(packageName);
PackageManager pm = mock(PackageManager.class);
when(pm.getApplicationInfo(eq(packageName), eq(PackageManager.GET_META_DATA)))
.thenReturn(applicationInfo);
when(context.getPackageManager()).thenReturn(pm);
parser = new ManifestParser(context);
}
示例2: setUp
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
exceptionListPool = FactoryPools.threadSafeList();
multiFactory = new MultiModelLoaderFactory(exceptionListPool,
multiModelLoaderFactory);
when(firstFactory.build(eq(multiFactory))).thenReturn(firstModelLoader);
when(secondFactory.build(eq(multiFactory))).thenReturn(secondModelLoader);
}
示例3: setUp
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setUp() throws MalformedURLException {
MockitoAnnotations.initMocks(this);
Mockito.when(client.getCloudControllerUrl()).thenReturn(new URL(CONTROLLER_ENDPOINT));
Mockito.when(client.getApplication(input.application.appName)).thenReturn(input.application.toCloudApp());
Mockito.when(restTemplateFactory.getRestTemplate(Mockito.eq(client))).thenReturn(restTemplate);
updateStaging = input.staging.toStaging();
}
示例4: testInitialize
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void testInitialize() throws Exception{
MockitoAnnotations.initMocks(this);
for (ApplianceManagerConnector mc: TEST_MANAGER_CONNECTORS) {
doReturn(mc).when(this.em).find(ApplianceManagerConnector.class, mc.getId());
}
setupApplianceManagerApiFactory(POLICY_MAPPING_SUPPORTED_MC.getManagerType(), true);
setupApplianceManagerApiFactory(POLICY_MAPPING_NOT_SUPPORTED_MC.getManagerType(), false);
when(this.apiFactoryServiceMock.syncsSecurityGroup(POLICY_MAPPING_SUPPORTED_MC.getManagerType())).thenReturn(true);
}
示例5: setupDiaryPresenter
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setupDiaryPresenter() {
// Mockito has a very convenient way to inject mocks by using the @Mock annotation. To
// inject the mocks in the test the initMocks method needs to be called.
MockitoAnnotations.initMocks(this);
// Get a reference to the class under test
mDiaryPresenter = new DiaryPresenter(mDiaryRepository, mDiaryView);
}
示例6: setUp
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception
{
MockitoAnnotations.initMocks(this);
globalProperties = new Properties();
transformerProperties = new TransformerProperties(subsystem, globalProperties);
}
示例7: setup
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
DisciplineResource disciplineResource = new DisciplineResource(disciplineService);
this.restDisciplineMockMvc = MockMvcBuilders.standaloneSetup(disciplineResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter).build();
}
示例8: setup
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@PostConstruct
public void setup() {
MockitoAnnotations.initMocks(this);
MultipleChoiceAnswerResource multipleChoiceAnswerResource = new MultipleChoiceAnswerResource();
ReflectionTestUtils.setField(multipleChoiceAnswerResource, "multipleChoiceAnswerRepository", multipleChoiceAnswerRepository);
this.restMultipleChoiceAnswerMockMvc = MockMvcBuilders.standaloneSetup(multipleChoiceAnswerResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setMessageConverters(jacksonMessageConverter).build();
}
示例9: setUp
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setUp(){
MockitoAnnotations.initMocks(this);
BankAccount bankAccount = new BankAccount();
bankAccount.setId(56765l);
bankAccount.setCpf("25146455732");
try {
when(client.create(any(), eq(BankAccount.class))).thenReturn(bankAccount);
when(client.get(anyLong(), eq(BankAccount.class))).thenReturn(bankAccount);
} catch (IOException e) {
fail(e.getMessage());
}
}
示例10: setup
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
when(bitmapPool.get(anyInt(), anyInt(), any(Bitmap.Config.class)))
.thenAnswer(new Util.CreateBitmap());
Context context = RuntimeEnvironment.application;
Glide.init(new GlideBuilder().setBitmapPool(bitmapPool).build(context));
circleCrop = new CircleCrop();
}
示例11: setUp
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
}
示例12: setup
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
}
示例13: init
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void init() {
MockitoAnnotations.initMocks(this);
PowerMockito.mockStatic(DataStore.class);
shiftControllerTest = new ShiftController();
}
示例14: setup
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
interactor = TestRootInteractor.create(presenter);
}
示例15: setUp
import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@BeforeEach
void setUp() {
MockitoAnnotations.initMocks(this);
factory = new TableInfoFactory();
}
开发者ID:HPI-Information-Systems,项目名称:AdvancedDataProfilingSeminar,代码行数:6,代码来源:TableInfoFactoryTest.java