Skip to content

Commit d576be5

Browse files
committed
Fix tests
1 parent 083856b commit d576be5

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

app/src/androidTest/java/com/iterable/iterableapi/testapp/InboxUITest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
import androidx.test.ext.junit.runners.AndroidJUnit4;
44
import androidx.test.rule.ActivityTestRule;
55

6+
import com.iterable.iterableapi.IterableApi;
67
import com.iterable.iterableapi.ui.R;
78
import com.iterable.iterableapi.ui.inbox.IterableInboxActivity;
89

910
import org.junit.Rule;
1011
import org.junit.Test;
1112
import org.junit.runner.RunWith;
1213

14+
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
1315
import static androidx.test.espresso.Espresso.onView;
1416
import static androidx.test.espresso.action.ViewActions.click;
1517
import static androidx.test.espresso.matcher.ViewMatchers.withId;
@@ -18,7 +20,13 @@
1820
@RunWith(AndroidJUnit4.class)
1921
public class InboxUITest {
2022
@Rule
21-
public ActivityTestRule rule = new ActivityTestRule<>(IterableInboxActivity.class);
23+
public ActivityTestRule<IterableInboxActivity> rule = new ActivityTestRule<IterableInboxActivity>(IterableInboxActivity.class) {
24+
@Override
25+
protected void beforeActivityLaunched() {
26+
super.beforeActivityLaunched();
27+
IterableApi.initialize(getApplicationContext(), "apiKey");
28+
}
29+
};
2230

2331
@Test
2432
public void basicTest() {

app/src/test/java/com/iterable/iterableapi/InboxUITest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import androidx.test.ext.junit.runners.AndroidJUnit4;
44
import androidx.test.rule.ActivityTestRule;
55

6-
import com.iterable.iterableapi.ui.inbox.IterableInboxActivity;
76
import com.iterable.iterableapi.ui.R;
7+
import com.iterable.iterableapi.ui.inbox.IterableInboxActivity;
88

99
import org.junit.Rule;
1010
import org.junit.Test;
11-
import org.junit.rules.TestRule;
1211
import org.junit.runner.RunWith;
1312

13+
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
1414
import static androidx.test.espresso.Espresso.onView;
1515
import static androidx.test.espresso.action.ViewActions.click;
1616
import static androidx.test.espresso.matcher.ViewMatchers.withId;
@@ -19,7 +19,13 @@
1919
@RunWith(AndroidJUnit4.class)
2020
public class InboxUITest {
2121
@Rule
22-
public ActivityTestRule rule = new ActivityTestRule<>(IterableInboxActivity.class);
22+
public ActivityTestRule<IterableInboxActivity> rule = new ActivityTestRule<IterableInboxActivity>(IterableInboxActivity.class) {
23+
@Override
24+
protected void beforeActivityLaunched() {
25+
super.beforeActivityLaunched();
26+
IterableApi.initialize(getApplicationContext(), "apiKey");
27+
}
28+
};
2329

2430
@Test
2531
public void basicTest() {

0 commit comments

Comments
 (0)