-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch uncaught RxJava errors in unit tests #438
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
saket
added
the
work in progress
Feature isn't complete and the PR shouldn't be merged yet
label
Jan 4, 2019
saket
force-pushed
the
sn/04jan/catch-swallowed-rx-errors
branch
from
January 4, 2019 12:18
97a703f
to
e545244
Compare
saket
removed
the
work in progress
Feature isn't complete and the PR shouldn't be merged yet
label
Jan 4, 2019
saket
force-pushed
the
sn/04jan/catch-swallowed-rx-errors
branch
from
January 4, 2019 12:19
e545244
to
75b9f45
Compare
vinaysshenoy
reviewed
Jan 7, 2019
saket
force-pushed
the
sn/04jan/catch-swallowed-rx-errors
branch
2 times, most recently
from
January 7, 2019 09:03
3b41902
to
a322f4b
Compare
vinaysshenoy
suggested changes
Jan 7, 2019
app/src/androidTest/java/org/simple/clinic/MigrationAndroidTest.kt
Outdated
Show resolved
Hide resolved
app/src/androidTest/java/org/simple/clinic/drugs/sync/PrescriptionSyncAndroidTest.kt
Outdated
Show resolved
Hide resolved
app/src/androidTest/java/org/simple/clinic/medicalhistory/MedicalHistorySyncAndroidTest.kt
Outdated
Show resolved
Hide resolved
@vinaysshenoy feedback addressed. |
saket
force-pushed
the
sn/04jan/catch-swallowed-rx-errors
branch
2 times, most recently
from
January 7, 2019 12:21
2a3f3c2
to
6522b89
Compare
Starting from RxJava2, uncaught errors are not thrown but instead sent to the thread's default error handler. This results in a situation where JUnit would always pass even if any RxJava chain encountered an error. This commit introduces a JUnit rule that observes uncaught errors, but it needs to be manually added to every test.
This also includes making jUnit library available to main source set and not just tests. This was done so that RxErrorsRule can be shared between unit tests and Android tests.
saket
force-pushed
the
sn/04jan/catch-swallowed-rx-errors
branch
from
January 8, 2019 06:31
6522b89
to
7f31a94
Compare
vinaysshenoy
approved these changes
Jan 8, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Starting from RxJava2, uncaught errors are not thrown but instead sent to the thread's default error handler. This results in a situation where JUnit would always pass even if any RxJava chain encounters an error.
More information here: ReactiveX/RxJava#5234
This commit introduces a JUnit rule that observes uncaught errors, but it needs to be manually added to every test. The rule was copied from AutoDispose.