Skip to content

first class support for Array and Sequence in api-fluent #459

@robstoll

Description

@robstoll

Platform (jvm, js, android):
Extension (none, kotlin 1.3, jdk8): none

Code related feature

Currently one has to convert an Array or a Sequence to List or Iterable in order to be able to use the corresponding assertion functions such as contains. For instance

expect(arr).asList().contains(..)

We would like to be able to provide the same functionality (well almost the same, more details below) we provide for List to Array (all array types, see arrayAssertions.kt) and the same functionality we provide for Iterable for Sequence.

In detail, for Array:

  • all functionality from iterableAssertions (and builder) without hasNext, hasNotNext
  • all functionality from collectionAssertions
  • all functionality from listAssertions

In detail, for Sequence:

  • all functionality from iterableAssertions (and builder) without hasNext, hasNotNext
  • isEmpty and isNotEmpty from collectionAssertions

I don't want to limit what approach is taken but it should be generative and please write down your idea here first so that we can discuss it before you start implementing things for nothing.
Note that your approach should be easily adoptable to the api-infix


Please react with 👍 if you would like to see Array and/or Sequence to be first-class citizens in Atrium, the more upvotes the more likely I will implement it myself -- feel free to sponsor me, that would be a motivation too.
You are of course welcome to work on this issue. Write I'll work on it as comment so that we can assign the task to you.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions