本文整理匯總了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);
}