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

Any.isNoneOf/isNotIn #180

Closed
robstoll opened this issue Oct 4, 2019 · 13 comments · Fixed by #559
Closed

Any.isNoneOf/isNotIn #180

robstoll opened this issue Oct 4, 2019 · 13 comments · Fixed by #559
Assignees
Labels
Milestone

Comments

@robstoll
Copy link
Owner

robstoll commented Oct 4, 2019

Platform (jvm, jdk8, js, android): all

Code related feature

expect(subject).isNoneOf(a, b, ...)
expect(subject).isNotIn(iterable)

//instead of
expect(subject).notToBe(a).notToBe(b)...
expect(subject).notToBe(iterable.next()).notToBe(iterable.next())...

However, reporting should not state multiple not to be (in case of a Reporter which shows all assertions) but reflect the intended grouping.
For instance:

expect(1).isNoneOf(1, 2, 3, 1)

should result in

expect: 1
* is none of:
   - 1

As we can see from the example, we don't have to check for unique values, that's the responsibility of the developer. Moreover, we want fail-fast behaviour (thus we don't see the second 1 in reporting).

Following the things you need to do:

atrium-logic

  • extend AnyAssertions with a function isNotIn which expects a List<T> (see existing functions as a guideline)
  • implement isNotIn in DefaultAnyAssertions use assertionBuilder.list..
    • add IS_NONE_OF("is none of") to DescriptionAnyAssertion for en_GB
    • add IS_NONE_OF("ist nicht") to DescriptionAnyAssertion for de_CH
      => use it for withDescriptionAndEmptyRepresentation
    • map the elements of List<T> to an assertionBuilder.representationOnly (similar to /domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/iterable/contains/creators/InAnyOrderOnlyAssertionCreator.kt => createExplanatoryGroupForMismatchesEtc) and use them for withAssertions

api-fluent-en_GB

  • provide a fun isNoneOf with signature (T, vararg T) (see mapAssertions.kt -> contains as a guideline)
    • add @since 0.9.0 to KDOC
  • provide a fun isNotIn with signature Iterable<T>
    • include a require that the Iterable.iterator.hasNext()
    • add @since 0.9.0 to KDOC
  • extend AnyAssertionsSpec in specs-common and extend it in atrium-api-fluent-en_GB-common/src/test

Your first contribution?

  • Write a comment I'll work on this if you would like to take this issue over.
    This way we get the chance to revise the description in case things have changed in the meantime,
    we might give you additional hints and we can assign the task to you, so that others do not start as well.
  • See Your first code contribution for guidelines.
  • Do not hesitate to ask questions here or to contact us via Atrium's slack channel if you need help
    (Invite yourself in case you do not have an account yet).
@DeMack
Copy link

DeMack commented Oct 5, 2019

I'll work on this.

@piyushmor
Copy link
Contributor

Hi, is someone working on this, else I will take over

@piyushmor
Copy link
Contributor

piyushmor commented Oct 13, 2019

@DeMack, are you working on this? Else, I will start

@robstoll
Copy link
Owner Author

@DeMack do you need help? un-assining you so that others can take over until I get a response

@gawarz
Copy link

gawarz commented Oct 23, 2019

I'll work on this.

@robstoll
Copy link
Owner Author

robstoll commented Nov 4, 2019

@gawarz let me know in case you need help

@robstoll
Copy link
Owner Author

@gawarz unassigning you so that others can take over. Just leave a comment here in case you still work on it and I assign you again.

@Jak-Sidious
Copy link
Contributor

I'll work on this

@robstoll
Copy link
Owner Author

@Jak-Sidious I just updated the description

@robstoll
Copy link
Owner Author

robstoll commented Apr 9, 2020

@Jak-Sidious un-assigning you so that others can take over

@z13z
Copy link
Contributor

z13z commented Jul 12, 2020

I'll work on this

@z13z
Copy link
Contributor

z13z commented Jul 19, 2020

Hello. I won't be able to finish this issue. please unasign me

@anesabml
Copy link
Contributor

@robstoll can I work on this?

robstoll added a commit that referenced this issue Aug 25, 2020
Add Any.isNoneOf and Any.isNotIn assertions
robstoll added a commit that referenced this issue Aug 25, 2020
Add Any.isNoneOf and Any.isNotIn assertions
@robstoll robstoll linked a pull request Aug 25, 2020 that will close this issue
robstoll added a commit that referenced this issue Aug 26, 2020
@robstoll robstoll added this to the 0.13.0 milestone Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants