doc / ch.tutteli.atrium.assertions.builders / AssertionBuilder / createDescriptive

createDescriptive

open fun createDescriptive(description: String, representation: Any?, test: () -> Boolean): DescriptiveAssertion (source)
open fun createDescriptive(description: Translatable, representation: Any?, test: () -> Boolean): DescriptiveAssertion (source)

Creates a DescriptiveAssertion based on the given description, representation and test.

Notice, if you want to use text (a String which is treated as raw string in reporting) as representation, then wrap it into a Text and pass it instead.

Shortcut for:

descriptive
  .withTest(test)
  .withDescriptionAndRepresentation(description, representation)
  .build()

Parameters

description - The description of the assertion, e.g. to Be

representation - The representation of the expected outcome

test - The test which checks whether the assertion holds

open fun <T> createDescriptive(expect: Expect<T>, description: String, representation: Any?, test: (T) -> Boolean): DescriptiveAssertion (source)
Deprecated: Use _logic.createDescriptive instead; will be removed with 0.18.0


open fun <T> createDescriptive(expect: Expect<T>, description: Translatable, representation: Any?, test: (T) -> Boolean): DescriptiveAssertion (source)
Deprecated: Use extension AssertionContainer.createDescriptiveAssertion instead - e.g. _logic.createDescriptiveAssertion; will be removed with 0.18.0

Creates a DescriptiveAssertion based on the description, representation and test as well as the SubjectProvider.maybeSubject of the given subjectProvider.

Notice, if you want to use text (a String which is treated as raw string in reporting) as representation, then wrap it into a Text and pass it instead.

Shortcut for:

descriptive
  .withTest(subjectProvider, test)
  .withDescriptionAndRepresentation(description, representation)
  .build()

Parameters

subjectProvider - The Expect from which we take the Expect.maybeSubject and pass it on to the given test.

description - The description of the assertion, e.g. to Be.

representation - The representation of the expected outcome.

test - The test which checks whether the assertion holds.