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


Java RuntimeEnvironment.application方法代码示例

本文整理汇总了Java中org.robolectric.RuntimeEnvironment.application方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeEnvironment.application方法的具体用法?Java RuntimeEnvironment.application怎么用?Java RuntimeEnvironment.application使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.robolectric.RuntimeEnvironment的用法示例。


在下文中一共展示了RuntimeEnvironment.application方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    final Application application = RuntimeEnvironment.application;
    sharedPreferences = application.getSharedPreferences("test", Context.MODE_PRIVATE);
    sharedPreferences.edit().clear().apply();

    //dataSaver = new SharedPreferencesDataSaver(sharedPreferences);
    dataSaver = new PaperDataSaver(application);
    dataSaver = spy(dataSaver);

    AndroidNoSql.initWith(
            dataSaver
    );
    noSql = NoSql.getInstance();
    noSql.reset();
}
 
开发者ID:florent37,项目名称:Android-NoSql,代码行数:17,代码来源:SharedPrefsTest.java

示例2: testSaveFcmCredentials

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Test public void testSaveFcmCredentials() {
  new Prefs(RuntimeEnvironment.application);
  Prefs.saveJwtToken("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI0U0lDWk05MmQ3Rnd4VG9lMGlwZUN3ZGRISXNWN1hNMEhmM1ppdUs4Y2hkWEwya3RxdVdJVndNRGlhc3ZRWGtWQ3pDVlV6Y21KSUplTUtEbWkxaXBNT2RlVnJEN1lLaWhrQVJBcmt3SGI1cWU2bTJPUFF4c0JVdTk0Rm1veEtacSJ9.W4AQ4XSV_19IJmELXuyBrbTxNZF28b2wLGVi-tfJjps");
  ServiceBuilder.init(Constants.BASE_URL, RuntimeEnvironment.application);

  try {
    FcmCredentials fcmCredentials = new FcmCredentials();
    fcmCredentials.setAccountId(Long.valueOf("1570123796151534997"));
    fcmCredentials.setToken(
        "e1sAmGApuFg:APA91bFhncSCrYlxuk10Zkcfy4M672gGQN2212MAj2AXTiu2favquLfyRrJkqppSNoc-Cz_tU7orSmeBE5Rmp5xCSEWWzkzn3R3hGyVOEZ2E0_BnbOhSug-fmgHCF-grAVSs3okUegGE");

    Response<BaseResponse<Object>> response =
        ServiceBuilder.getFcmService().saveFcmToken(fcmCredentials).execute();

    assertTrue(response.isSuccessful());
  } catch (Exception e) {
    e.printStackTrace();
  }
}
 
开发者ID:humaniq,项目名称:react-native-android-library-humaniq-api,代码行数:20,代码来源:ProfileApiTest.java

示例3: beforeTest

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
/**
 */
@Override
@CallSuper
public void beforeTest() throws Exception {
	super.beforeTest();
	this.mApplication = RuntimeEnvironment.application;
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:9,代码来源:RobolectricTestCase.java

示例4: shutdownDisallowedOnSingletonInstance

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Test public void shutdownDisallowedOnSingletonInstance() {
  Picasso.singleton = null;
  PicassoProvider.context = RuntimeEnvironment.application;
  try {
    Picasso.with().shutdown();
    fail("Calling shutdown() on static singleton instance should throw");
  } catch (UnsupportedOperationException expected) {
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:PicassoTest.java

示例5: setup

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void setup() {
    context = RuntimeEnvironment.application;
    packageManager = context.getPackageManager();
    jobStore = JobStore.get(context);
    service = Robolectric.buildService(AlarmJobService.class).create();
}
 
开发者ID:Doist,项目名称:JobSchedulerCompat,代码行数:8,代码来源:AlarmReceiverTest.java

示例6: setup

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext, mContext);
  Fresco.initialize(mContext);
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:10,代码来源:ReactImagePropertyTest.java

示例7: setUp

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  bitmapToTransform = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);

  context = RuntimeEnvironment.application;
  Glide.init(new GlideBuilder().setBitmapPool(bitmapPool).build(context));
  when(drawableResourceToTransform.get()).thenReturn(drawableToTransform);
  when(drawableToTransform.getBitmap()).thenReturn(bitmapToTransform);
  transformation = new BitmapDrawableTransformation(wrapped);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:BitmapDrawableTransformationTest.java

示例8: setUp

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void setUp()
{
    // Output logs emitted during tests so they may be accessed
    ShadowLog.stream = System.out;
    db = new DBHelper(RuntimeEnvironment.application);

    prefs = RuntimeEnvironment.application.getSharedPreferences("protect.rentalcalc", Context.MODE_PRIVATE);
    // Assume that this is not the first launch
    prefs.edit().putBoolean("firstrun", false).commit();
}
 
开发者ID:brarcher,项目名称:rental-calc,代码行数:12,代码来源:PropertiesListActivityTest.java

示例9: setUp

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  context = RuntimeEnvironment.application;

  Glide.init(context, new GlideBuilder().setBitmapPool(bitmapPool));
  transformation = new GifDrawableTransformation(wrapped);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:GifDrawableTransformationTest.java

示例10: testUpdatesAppWidgetWhenCreatedWithWidgetIds

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Test
public void testUpdatesAppWidgetWhenCreatedWithWidgetIds() {
  int[] widgetIds = new int[] { 1 };
  AppWidgetTarget target =
      new AppWidgetTarget(RuntimeEnvironment.application, viewId, views, widgetIds);

  target.onResourceReady(Bitmap.createBitmap(200, 100, Bitmap.Config.ARGB_8888), null
  /*glideAnimation*/);

  assertThat(widgetIds).isEqualTo(shadowManager.updatedWidgetIds);
  assertEquals(views, shadowManager.updatedRemoteViews);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:AppWidgetTargetTest.java

示例11: setup

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void setup() {
    trackingProtectionWebViewClient = new TrackingProtectionWebViewClient(RuntimeEnvironment.application);

    webView = mock(WebView.class);
    when(webView.getContext()).thenReturn(RuntimeEnvironment.application);
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:8,代码来源:TrackingProtectionWebViewClientTest.java

示例12: setUp

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void setUp() {
  listener = mock(ConnectivityMonitor.ConnectivityListener.class);
  monitor = new DefaultConnectivityMonitor(RuntimeEnvironment.application, listener);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:DefaultConnectivityMonitorTest.java

示例13: beforeEachTest

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before public void beforeEachTest() {
    Context context = RuntimeEnvironment.application;
    mapper = new FactsViewModelMapper(context);
}
 
开发者ID:ubiratansoares,项目名称:reactive-architectures-playground,代码行数:5,代码来源:FactsViewModelMapperTests.java

示例14: getTestApplication

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
private PostsApplication getTestApplication() {
    return (PostsApplication) RuntimeEnvironment.application;
}
 
开发者ID:ParaskP7,项目名称:sample-code-posts,代码行数:4,代码来源:RobolectricGeneralTestHelper.java

示例15: before

import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void before() {
    context = RuntimeEnvironment.application;
    mockAccount = mock(Account.class);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:6,代码来源:FolderInfoHolderTest.java


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