当前位置: 首页>>代码示例>>Java>>正文


Java MockitoAnnotations.initMocks方法代码示例

本文整理汇总了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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:ManifestParserTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:MultiModelLoaderFactoryTest.java

示例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();
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:9,代码来源:ApplicationStagingUpdaterTest.java

示例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);
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:14,代码来源:MCConformanceCheckMetaTaskTest.java

示例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);
}
 
开发者ID:jgevans,项目名称:TherapyGuide,代码行数:10,代码来源:DiaryPresenterTest.java

示例6: setUp

import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception
{
    MockitoAnnotations.initMocks(this);
    globalProperties = new Properties();
    transformerProperties = new TransformerProperties(subsystem, globalProperties);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:TransformerPropertiesTest.java

示例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();
}
 
开发者ID:ElectronicArmory,项目名称:Armory,代码行数:10,代码来源:DisciplineResourceIntTest.java

示例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();
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:10,代码来源:MultipleChoiceAnswerResourceIntTest.java

示例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());
	}
}
 
开发者ID:ac-silva,项目名称:desafio-pagarme,代码行数:14,代码来源:BankAccountHandlerTest.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:CircleCropTest.java

示例11: setUp

import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
}
 
开发者ID:DDD-MicroService-Kata,项目名称:petstore-order,代码行数:5,代码来源:OrderApplicationServiceTest.java

示例12: setup

import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:ElectionTermImplTest.java

示例13: init

import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void init() {
    MockitoAnnotations.initMocks(this);
    PowerMockito.mockStatic(DataStore.class);
    shiftControllerTest = new ShiftController();
}
 
开发者ID:cocolocomoco21,项目名称:ULCRS,代码行数:7,代码来源:ShiftControllerTest.java

示例14: setup

import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@Before
public void setup() {
  MockitoAnnotations.initMocks(this);

  interactor = TestRootInteractor.create(presenter);
}
 
开发者ID:uber,项目名称:RIBs,代码行数:7,代码来源:RootInteractorTest.java

示例15: setUp

import org.mockito.MockitoAnnotations; //导入方法依赖的package包/类
@BeforeEach
void setUp() {
  MockitoAnnotations.initMocks(this);
  factory = new TableInfoFactory();
}
 
开发者ID:HPI-Information-Systems,项目名称:AdvancedDataProfilingSeminar,代码行数:6,代码来源:TableInfoFactoryTest.java


注:本文中的org.mockito.MockitoAnnotations.initMocks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。