Skip to content

Commit 479e831

Browse files
committed
test: Java 1.7, made test base class abstract, added EventBus.toString
1 parent ddf19d2 commit 479e831

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

EventBus/src/de/greenrobot/event/EventBus.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ protected PostingThreadState initialValue() {
7272
private final boolean sendNoSubscriberEvent;
7373
private final boolean eventInheritance;
7474

75+
private final int indexCount;
76+
7577
/** Convenience singleton for apps using a process-wide EventBus instance. */
7678
public static EventBus getDefault() {
7779
if (defaultInstance == null) {
@@ -109,6 +111,7 @@ public EventBus() {
109111
mainThreadPoster = new HandlerPoster(this, Looper.getMainLooper(), 10);
110112
backgroundPoster = new BackgroundPoster(this);
111113
asyncPoster = new AsyncPoster(this);
114+
indexCount = builder.subscriberInfoIndexes != null ? builder.subscriberInfoIndexes.size() : 0;
112115
subscriberMethodFinder = new SubscriberMethodFinder(builder.subscriberInfoIndexes,
113116
builder.strictMethodVerification, builder.ignoreGeneratedIndex);
114117
logSubscriberExceptions = builder.logSubscriberExceptions;
@@ -532,4 +535,8 @@ ExecutorService getExecutorService() {
532535
void onPostCompleted(List<SubscriberExceptionEvent> exceptionEvents);
533536
}
534537

538+
@Override
539+
public String toString() {
540+
return "EventBus[indexCount=" + indexCount + ", eventInheritance=" + eventInheritance + "]";
541+
}
535542
}

EventBusTest/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ buildscript {
1212
apply plugin: 'com.android.application'
1313
apply plugin: 'com.neenbedankt.android-apt'
1414

15+
sourceCompatibility = 1.7
16+
1517
repositories {
1618
jcenter()
1719
}
@@ -28,6 +30,11 @@ android {
2830
buildToolsVersion '23.0.2'
2931
compileSdkVersion 19
3032

33+
compileOptions {
34+
sourceCompatibility = JavaVersion.VERSION_1_7
35+
targetCompatibility = JavaVersion.VERSION_1_7
36+
}
37+
3138
sourceSets {
3239
main {
3340
manifest.srcFile 'AndroidManifest.xml'

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
* @author Markus Junginger, greenrobot
3838
*/
3939
@RunWith(AndroidJUnit4.class)
40-
@Ignore("Base class")
41-
public class AbstractEventBusTest {
40+
public abstract class AbstractEventBusTest {
4241
/** Activates long(er) running tests e.g. testing multi-threading more thoroughly. */
4342
protected static final boolean LONG_TESTS = false;
4443

0 commit comments

Comments
 (0)