Skip to content

Instantly share code, notes, and snippets.

@hadilq
Created November 25, 2018 12:51
Show Gist options
  • Save hadilq/d094951f4cf4b378968471dedc5ce7b0 to your computer and use it in GitHub Desktop.
Save hadilq/d094951f4cf4b378968471dedc5ce7b0 to your computer and use it in GitHub Desktop.
fun exampleMethod(foo: Boolean, bar: Boolean, ..., baz: Any?) {
assumeTrue("Message of AssertionError when this assumption is not satisfied", foo)
?.assumeFalse("The same as the above message", bar)
...
?.assumeNotNull("An other message", baz) {
// If all the above assumptions get satisfied then this block will be running.
// Else an Assertion log will be triggered on the proper Appenders.
}
// Add more assumptions for the next block
?.assumeEquals("A message", foo, bar) {
// This block will be running if all the above assumptions are true.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment