本文整理汇总了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();
}
示例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();
}
}
示例3: beforeTest
import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
/**
*/
@Override
@CallSuper
public void beforeTest() throws Exception {
super.beforeTest();
this.mApplication = RuntimeEnvironment.application;
}
示例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) {
}
}
示例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();
}
示例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());
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例12: setUp
import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void setUp() {
listener = mock(ConnectivityMonitor.ConnectivityListener.class);
monitor = new DefaultConnectivityMonitor(RuntimeEnvironment.application, listener);
}
示例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;
}
示例15: before
import org.robolectric.RuntimeEnvironment; //导入方法依赖的package包/类
@Before
public void before() {
context = RuntimeEnvironment.application;
mockAccount = mock(Account.class);
}