Search in sources :

Example 1 with AppCenter

use of com.microsoft.appcenter.AppCenter in project mobile-center-sdk-android by Microsoft.

the class CrashesAndroidTest method startFresh.

private void startFresh(CrashesListener listener) throws Exception {
    /* Configure new instance. */
    AppCenterPrivateHelper.unsetInstance();
    Crashes.unsetInstance();
    AppCenter.setLogLevel(android.util.Log.VERBOSE);
    AppCenter.configure(sApplication, "a");
    /* Clean logs. */
    AppCenter.setEnabled(false);
    AppCenter.setEnabled(true).get();
    /* Replace channel. */
    Method method = AppCenter.class.getDeclaredMethod("getInstance");
    method.setAccessible(true);
    AppCenter appCenter = (AppCenter) method.invoke(null);
    method = AppCenter.class.getDeclaredMethod("setChannel", Channel.class);
    method.setAccessible(true);
    method.invoke(appCenter, mChannel);
    /* Set listener. */
    Crashes.setListener(listener);
    /* Start crashes. */
    AppCenter.start(Crashes.class);
    /* Wait for start. */
    assertTrue(Crashes.isEnabled().get());
}
Also used : AppCenter(com.microsoft.appcenter.AppCenter) Channel(com.microsoft.appcenter.channel.Channel) Method(java.lang.reflect.Method)

Example 2 with AppCenter

use of com.microsoft.appcenter.AppCenter in project mobile-center-sdk-android by Microsoft.

the class WrapperSdkExceptionManagerAndroidTest method startFresh.

private void startFresh() throws java.lang.Exception {
    /* Configure new instance. */
    AppCenterPrivateHelper.unsetInstance();
    Crashes.unsetInstance();
    AppCenter.setLogLevel(android.util.Log.VERBOSE);
    AppCenter.configure(sApplication, "a");
    /* Replace channel. */
    Method method = AppCenter.class.getDeclaredMethod("getInstance");
    method.setAccessible(true);
    AppCenter appCenter = (AppCenter) method.invoke(null);
    method = AppCenter.class.getDeclaredMethod("setChannel", Channel.class);
    method.setAccessible(true);
    method.invoke(appCenter, mock(Channel.class));
    /* Start crashes. */
    AppCenter.start(Crashes.class);
    /* Wait for start. */
    Assert.assertTrue(Crashes.isEnabled().get());
}
Also used : AppCenter(com.microsoft.appcenter.AppCenter) Channel(com.microsoft.appcenter.channel.Channel) Method(java.lang.reflect.Method)

Aggregations

AppCenter (com.microsoft.appcenter.AppCenter)2 Channel (com.microsoft.appcenter.channel.Channel)2 Method (java.lang.reflect.Method)2