Skip to content

first() does not print expected for empty lists #287

@robd

Description

@robd
  @Test
  fun `first() handles empty lists`() {
    val subject = emptyList<String>()
    expectThat(subject).first().isEqualTo("catflap")
  }

Fails with the message:

Mapping 'first element %s' failed with: List is empty.
Mapping 'first element %s' failed with: List is empty.
	at app//strikt.internal.AssertionBuilder.get(AssertionBuilder.kt:108)

Wonder if it is possible to show the expected - it can be hard to know which assertion failed if there is more than one 'first()' in a test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions