Skip to content
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

Workflow tester improvements #318

Merged
merged 3 commits into from
Apr 25, 2019

Conversation

zach-klippenstein
Copy link
Collaborator

Three commits:

  1. Remove WorkflowTester.with* methods. Closes withNextRendering et al aren't necessary #292.
  2. Make WorkflowTester the receiver of the lambdas to Workflow.test* methods.
    I initially made it an explicit argument because I thought it increased readability,
    but after writing a bunch of tests, and occasionally using different names for that
    argument, since the entire point of the lambda passed to Workflow.test* methods is
    to operator on the WorkflowTester I think it's actually more readable as a receiver.
  3. Merge WorkflowTesting.kt into WorkflowTester.kt.

…hods.

I initially made it an explicit argument because I thought it increased readability,
but after writing a bunch of tests, and occasionally using different names for that
argument, since the entire point of the lambda passed to `Workflow.test*` methods is
to operator on the `WorkflowTester` I think it's actually more readable as a receiver.
@zach-klippenstein zach-klippenstein added this to the v0.15.0 milestone Apr 24, 2019
@zach-klippenstein zach-klippenstein added this to In progress in Workflow (Kotlin) via automation Apr 24, 2019
@zach-klippenstein zach-klippenstein merged commit 50a0529 into master Apr 25, 2019
Workflow (Kotlin) automation moved this from In progress to Done Apr 25, 2019
@zach-klippenstein zach-klippenstein deleted the zachklipp/workflow-tester-improvements branch April 25, 2019 20:46
@Suppress("DEPRECATION")
val cancelled = context.cancel(error)
if (!cancelled) {
val cancellationCause = context[Job]!!.getCancellationException()
Copy link

@kirillzh kirillzh Apr 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requireNotNull() would give better error message in case of NPE.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not possible to have a null here, since we explicitly give the context a Job on line 262. If it does have a null, someone edited this file and broke something, and I'm not worried about the error message in that case.

@kirillzh
Copy link

Neat, neat!

@zach-klippenstein zach-klippenstein added the kotlin Affects the Kotlin library. label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kotlin Affects the Kotlin library.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

withNextRendering et al aren't necessary
3 participants