-
Notifications
You must be signed in to change notification settings - Fork 80
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
Throw workflow exceptions from test/testFromStart instead of leaking to uncaught exception handler. #686
Throw workflow exceptions from test/testFromStart instead of leaking to uncaught exception handler. #686
Conversation
40156ff
to
4a76ade
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
...al-testing-utils/src/main/java/com/squareup/workflow/internal/util/UncaughtExceptionGuard.kt
Outdated
Show resolved
Hide resolved
...al-testing-utils/src/main/java/com/squareup/workflow/internal/util/UncaughtExceptionGuard.kt
Show resolved
Hide resolved
* ## Usage | ||
* | ||
* 1. Register an uncaught exception handler to report uncaught exceptions with [reportUncaught]. | ||
* 2. Run your code with [runRethrowingUncaught]. Any exceptions passed to [reportUncaught] will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No discussion of rethrowingUncaughtExceptions()
, so I come away unclear when I should use that and when I should use these methods directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a note saying when to use it.
...esting-utils/src/test/java/com/squareup/workflow/internal/util/UncaughtExceptionGuardTest.kt
Outdated
Show resolved
Hide resolved
…to uncaught exception handler. Simplifies testing API by removing `awaitFailure()` – this method is now redundant since any failures are thrown from the `test`/`testFromStart` function directly. This is simpler to use since any exceptions from the workflow or runtime are now just thrown normally and will always cause tests to fail, and it doesn't require any additional API to test expected failures. Fixe #635.
4a76ade
to
df316bf
Compare
Simplifies testing API by removing
awaitFailure()
– this method is now redundant since anyfailures are thrown from the
test
/testFromStart
function directly. This is simpler to use sinceany exceptions from the workflow or runtime are now just thrown normally and will always cause
tests to fail, and it doesn't require any additional API to test expected failures.
Fixe #635.