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

Support assertions in TestWorkflowEnvironment.registerDelayedCallback #597

Open
zhxnlai opened this issue Jul 20, 2021 · 0 comments
Open
Labels
enhancement User experience

Comments

@zhxnlai
Copy link
Contributor

zhxnlai commented Jul 20, 2021

Is your feature request related to a problem? Please describe.

When assertions fail in TestWorkflowEnvironment.registerDelayedCallback, the errors in the callback are swallowed. This is counterintuitive.

For instance, I expect the following test to fail.

class MyTest {

  private val testEnv: TestWorkflowEnvironment
  
  @Test
  fun thisShouldFail() {
    testEnv.registerDelayedCallback(Duration.ofSeconds(1)) {
      assertThat(false).isTrue()
    }
    testEnv.sleep(Duration.ofSeconds(10))
  }
}

But it succeeds with an error log.

10:35:11.197 [Timer task] ERROR i.t.i.t.SelfAdvancingTimerImpl - Unexpected failure in timer callback
org.opentest4j.AssertionFailedError: 
Expecting value to be true but was false
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

Describe the solution you'd like
Propagate the error to the test method.

@zhxnlai zhxnlai added the enhancement User experience label Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement User experience
Projects
None yet
Development

No branches or pull requests

1 participant