Skip to content

Commit b47bc62

Browse files
committed
fix(android): resolve test failure caused by missing Android stub defaults
1 parent e63b0af commit b47bc62

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

rollbar-android/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ android {
2525
}
2626
}
2727

28+
testOptions {
29+
unitTests.isReturnDefaultValues = true
30+
}
31+
2832
compileOptions {
2933
sourceCompatibility = JavaVersion.VERSION_1_8
3034
targetCompatibility = JavaVersion.VERSION_1_8

rollbar-android/src/test/java/com/rollbar/android/LogcatTelemetryCaptureTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ public void start_afterUnexpectedProcessDeath_allowsRestartWithNewProcess() thro
159159
LogcatTelemetryCapture capture = new LogcatTelemetryCapture(tracker, Level.WARNING, "Rollbar", factory);
160160
capture.start();
161161

162-
// Allow the reader thread to detect EOF and reset running=false via stop()
163-
Thread.sleep(200);
164-
165-
capture.start();
162+
// Poll start() until the reader thread detects EOF and resets running=false
163+
long deadline = System.currentTimeMillis() + 2000;
164+
while (factoryCallCount.get() < 2 && System.currentTimeMillis() < deadline) {
165+
Thread.sleep(10);
166+
capture.start();
167+
}
166168

167169
assertEquals(2, factoryCallCount.get());
168170
}

0 commit comments

Comments
 (0)