/
BreadcrumbLifecycleCrashTest.java
38 lines (31 loc) · 1.19 KB
/
BreadcrumbLifecycleCrashTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.bugsnag.android;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@SmallTest
public class BreadcrumbLifecycleCrashTest {
private SessionTracker sessionTracker;
/**
* Creates a SessionTracker with a null client
*
* @throws Exception if the SessionTracker couldn't be created
*/
@Before
public void setUp() throws Exception {
Configuration configuration = new Configuration("api-key");
Context context = InstrumentationRegistry.getContext();
SessionStore sessionStore = new SessionStore(configuration, context);
SessionTrackingApiClient apiClient = BugsnagTestUtils.generateSessionTrackingApiClient();
sessionTracker = new SessionTracker(configuration, null, sessionStore, apiClient);
}
@Test
public void testLifecycleBreadcrumbCrash() {
// should not crash with a null client
sessionTracker.leaveLifecycleBreadcrumb("FooActivity", "onCreate");
}
}