當前位置: 首頁>>代碼示例>>Java>>正文


Java ShadowLog.setupLogging方法代碼示例

本文整理匯總了Java中org.robolectric.shadows.ShadowLog.setupLogging方法的典型用法代碼示例。如果您正苦於以下問題:Java ShadowLog.setupLogging方法的具體用法?Java ShadowLog.setupLogging怎麽用?Java ShadowLog.setupLogging使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.robolectric.shadows.ShadowLog的用法示例。


在下文中一共展示了ShadowLog.setupLogging方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: displayWarningForMissingActivities_withOneMissingActivity_shouldLogOnlyThatOne

import org.robolectric.shadows.ShadowLog; //導入方法依賴的package包/類
@Test
 public void displayWarningForMissingActivities_withOneMissingActivity_shouldLogOnlyThatOne() throws Exception {
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MoPubActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MraidActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MraidVideoPlayerActivity.class), mockResolveInfo);
    // Here, we leave out MoPubBrowser on purpose

    ShadowLog.setupLogging();

    ManifestUtils.displayWarningForMissingActivities(context, requiredWebViewSdkActivities);

    assertLogIncludes("com.mopub.common.MoPubBrowser");
    assertLogDoesntInclude(
            "com.mopub.mobileads.MoPubActivity",
            "com.mopub.mobileads.MraidActivity",
            "com.mopub.mobileads.MraidVideoPlayerActivity"
    );
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:19,代碼來源:ManifestUtilsTest.java

示例2: displayWarningForMissingActivities_withAllMissingActivities_shouldLogMessage

import org.robolectric.shadows.ShadowLog; //導入方法依賴的package包/類
@Test
public void displayWarningForMissingActivities_withAllMissingActivities_shouldLogMessage() throws Exception {
    setDebugMode(true);
    ShadowLog.setupLogging();

    ManifestUtils.displayWarningForMissingActivities(context, requiredWebViewSdkActivities);

    final List<ShadowLog.LogItem> logs = ShadowLog.getLogs();

    assertLogIncludes(
            "com.mopub.mobileads.MoPubActivity",
            "com.mopub.mobileads.MraidActivity",
            "com.mopub.mobileads.MraidVideoPlayerActivity",
            "com.mopub.common.MoPubBrowser"
    );
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:17,代碼來源:ManifestUtilsTest.java

示例3: displayWarningForMisconfiguredActivities_withAllActivitiesConfigured_shouldNotLogOrShowToast

import org.robolectric.shadows.ShadowLog; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@TargetApi(13)
@Test
public void displayWarningForMisconfiguredActivities_withAllActivitiesConfigured_shouldNotLogOrShowToast() throws Exception {
    ManifestUtils.FlagCheckUtil mockActivitiyConfigCheck = mock(ManifestUtils.FlagCheckUtil.class);
    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_KEYBOARD_HIDDEN))).thenReturn(true);
    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_ORIENTATION))).thenReturn(true);
    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_SCREEN_SIZE))).thenReturn(true);
    ManifestUtils.setFlagCheckUtil(mockActivitiyConfigCheck);

    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MoPubActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MraidActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MraidVideoPlayerActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MoPubBrowser.class), mockResolveInfo);

    ShadowLog.setupLogging();
    setDebugMode(true);

    ManifestUtils.displayWarningForMisconfiguredActivities(context, requiredWebViewSdkActivities);

    assertThat(ShadowToast.getLatestToast()).isNull();
    assertThat(ShadowLog.getLogs()).isEmpty();
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:24,代碼來源:ManifestUtilsTest.java

示例4: mock

import org.robolectric.shadows.ShadowLog; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@TargetApi(13)
@Test
public void displayWarningForMisconfiguredActivities_withOneMisconfiguredActivity_withMissingAllConfigChangesValues_shouldLogAllConfigChangesValues() throws Exception {
    ManifestUtils.FlagCheckUtil mockActivitiyConfigCheck = mock(ManifestUtils.FlagCheckUtil.class);

    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_KEYBOARD_HIDDEN))).thenReturn(false);
    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_ORIENTATION))).thenReturn(false);
    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_SCREEN_SIZE))).thenReturn(false);
    ManifestUtils.setFlagCheckUtil(mockActivitiyConfigCheck);

    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MoPubActivity.class), mockResolveInfo);

    ShadowLog.setupLogging();

    ManifestUtils.displayWarningForMisconfiguredActivities(context, requiredWebViewSdkActivities);

    assertLogIncludes("The android:configChanges param for activity " + MoPubActivity.class.getName() + " must include keyboardHidden.");
    assertLogIncludes("The android:configChanges param for activity " + MoPubActivity.class.getName() + " must include orientation.");
    assertLogIncludes("The android:configChanges param for activity " + MoPubActivity.class.getName() + " must include screenSize.");
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:22,代碼來源:ManifestUtilsTest.java

示例5: when

import org.robolectric.shadows.ShadowLog; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@TargetApi(13)
@Test
public void displayWarningForMisconfiguredActivities_withMissingScreenSize_withTargetApiLessThan13_shouldNotLogOrShowToast() throws Exception {
    // Set target API to < 13
    ApplicationInfo applicationInfo = context.getApplicationInfo();
    applicationInfo.targetSdkVersion = Build.VERSION_CODES.HONEYCOMB_MR1;
    when(context.getApplicationInfo()).thenReturn(applicationInfo);

    ManifestUtils.FlagCheckUtil mockActivitiyConfigCheck = mock(ManifestUtils.FlagCheckUtil.class);
    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_KEYBOARD_HIDDEN))).thenReturn(true);
    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_ORIENTATION))).thenReturn(true);
    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_SCREEN_SIZE))).thenReturn(false);
    ManifestUtils.setFlagCheckUtil(mockActivitiyConfigCheck);

    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MoPubActivity.class), mockResolveInfo);

    ShadowLog.setupLogging();
    setDebugMode(true);

    ManifestUtils.displayWarningForMisconfiguredActivities(context, requiredWebViewSdkActivities);

    assertThat(ShadowToast.getLatestToast()).isNull();
    assertThat(ShadowLog.getLogs()).isEmpty();
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:26,代碼來源:ManifestUtilsTest.java

示例6: checkWebViewSdkActivitiesDeclared_shouldIncludeFourActivityDeclarations

import org.robolectric.shadows.ShadowLog; //導入方法依賴的package包/類
@Test
public void checkWebViewSdkActivitiesDeclared_shouldIncludeFourActivityDeclarations() throws Exception {
    ShadowLog.setupLogging();

    ManifestUtils.checkWebViewActivitiesDeclared(context);

    assertLogIncludes(
            "com.mopub.mobileads.MoPubActivity",
            "com.mopub.mobileads.MraidActivity",
            "com.mopub.mobileads.MraidVideoPlayerActivity",
            "com.mopub.common.MoPubBrowser"
    );
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:14,代碼來源:ManifestUtilsTest.java

示例7: checkNativeSdkActivitiesDeclared_shouldIncludeOneActivityDeclaration

import org.robolectric.shadows.ShadowLog; //導入方法依賴的package包/類
@Test
public void checkNativeSdkActivitiesDeclared_shouldIncludeOneActivityDeclaration() throws Exception {
    ShadowLog.setupLogging();

    ManifestUtils.checkNativeActivitiesDeclared(context);

    assertLogIncludes("com.mopub.common.MoPubBrowser");
    assertLogDoesntInclude(
            "com.mopub.mobileads.MoPubActivity",
            "com.mopub.mobileads.MraidActivity",
            "com.mopub.mobileads.MraidVideoPlayerActivity"
    );
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:14,代碼來源:ManifestUtilsTest.java

示例8: displayWarningForMissingActivities_withAllActivitiesDeclared_shouldNotShowLogOrToast

import org.robolectric.shadows.ShadowLog; //導入方法依賴的package包/類
@Test
public void displayWarningForMissingActivities_withAllActivitiesDeclared_shouldNotShowLogOrToast() throws Exception {
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MoPubActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MraidActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MraidVideoPlayerActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MoPubBrowser.class), mockResolveInfo);

    ShadowLog.setupLogging();
    setDebugMode(true);

    ManifestUtils.displayWarningForMissingActivities(context, requiredWebViewSdkActivities);

    assertThat(ShadowToast.getLatestToast()).isNull();
    assertThat(ShadowLog.getLogs()).isEmpty();
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:16,代碼來源:ManifestUtilsTest.java

示例9: displayWarningForMisconfiguredActivities_withOneMisconfiguredActivity_shouldLogOnlyThatOne

import org.robolectric.shadows.ShadowLog; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@TargetApi(13)
@Test
public void displayWarningForMisconfiguredActivities_withOneMisconfiguredActivity_shouldLogOnlyThatOne() throws Exception {
    ManifestUtils.FlagCheckUtil mockActivitiyConfigCheck = mock(ManifestUtils.FlagCheckUtil.class);

    // Misconfigure the first activity; only return false if the activity is MoPubActivity
    doAnswer(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            Object[] args = invocationOnMock.getArguments();
            return MoPubActivity.class != args[0];
        }
    }).when(mockActivitiyConfigCheck).hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_KEYBOARD_HIDDEN));

    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_ORIENTATION))).thenReturn(true);
    when(mockActivitiyConfigCheck.hasFlag(any(Class.class), anyInt(), eq(ActivityInfo.CONFIG_SCREEN_SIZE))).thenReturn(true);
    ManifestUtils.setFlagCheckUtil(mockActivitiyConfigCheck);

    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MoPubActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MraidActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MraidVideoPlayerActivity.class), mockResolveInfo);
    Robolectric.packageManager.addResolveInfoForIntent(new Intent(context, MoPubBrowser.class), mockResolveInfo);

    ShadowLog.setupLogging();

    ManifestUtils.displayWarningForMisconfiguredActivities(context, requiredWebViewSdkActivities);

    assertLogIncludes("com.mopub.mobileads.MoPubActivity");
    assertLogIncludes("The android:configChanges param for activity " + MoPubActivity.class.getName() + " must include keyboardHidden.");
    assertLogDoesntInclude(
            "com.mopub.mobileads.MraidActivity",
            "com.mopub.mobileads.MraidVideoPlayerActivity",
            "com.mopub.common.MoPubBrowser"
    );
    assertLogDoesntInclude("The android:configChanges param for activity " + MoPubActivity.class.getName() + " must include orientation.");
    assertLogDoesntInclude("The android:configChanges param for activity " + MoPubActivity.class.getName() + " must include screenSize.");
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:39,代碼來源:ManifestUtilsTest.java

示例10: resetStaticState

import org.robolectric.shadows.ShadowLog; //導入方法依賴的package包/類
@Override
public void resetStaticState(Config config) {
  Robolectric.reset(config);

  if (!loggingInitialized) {
    ShadowLog.setupLogging();
    loggingInitialized = true;
  }
}
 
開發者ID:qx,項目名稱:FullRobolectricTestSample,代碼行數:10,代碼來源:ParallelUniverse.java


注:本文中的org.robolectric.shadows.ShadowLog.setupLogging方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。