Skip to content

Commit ddf19d2

Browse files
committed
fixing @UiThreadTest
1 parent 93e8ba6 commit ddf19d2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

EventBusTest/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies {
2121
androidTestCompile project(':EventBus')
2222
compile fileTree(dir: 'libs', include: '*.jar')
2323
androidTestCompile 'com.android.support.test:runner:0.4.1'
24+
androidTestCompile 'com.android.support.test:rules:0.4.1'
2425
}
2526

2627
android {

EventBusTest/src/de/greenrobot/event/test/EventBusBasicTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
package de.greenrobot.event.test;
1717

1818
import android.app.Activity;
19+
import android.support.test.rule.UiThreadTestRule;
1920
import android.support.test.runner.AndroidJUnit4;
20-
import android.test.UiThreadTest;
21+
import android.support.test.annotation.UiThreadTest;
2122
import android.util.Log;
2223
import de.greenrobot.event.EventBus;
2324
import de.greenrobot.event.Subscribe;
2425
import org.junit.Before;
26+
import org.junit.Rule;
2527
import org.junit.Test;
2628
import org.junit.runner.RunWith;
2729

@@ -32,6 +34,8 @@
3234
*/
3335
@RunWith(AndroidJUnit4.class)
3436
public class EventBusBasicTest {
37+
@Rule
38+
public final UiThreadTestRule uiThreadTestRule = new UiThreadTestRule();
3539

3640
private EventBus eventBus;
3741
private String lastStringEvent;

0 commit comments

Comments
 (0)