Atrium: mapAssertions for the new infix API

Created on 18 Oct 2019  路  10Comments  路  Source: robstoll/atrium

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

Code related feature

We want to migrate the api-cc-infix-en_GB... modules which are based on Assert to Expect. We have already created the corresponding
modules api-infix-en_GB.... Also there are already fluent-en_GB... modules where we have already done the transition from Assert to Expect

Following the things you need to do:

  • copy the file mapAssertions.kt from atrium-api-fluent-en_GB-common to atrium-api-infix-en_GB-common

    • adjust the signatures of the assertion functions so that they are infix functions (see mapAssertions.kt in atrium-api-cc-infix-en_GB-common for a guideline)

    • convert the vararg functions to two functions, one which expects only one parameter and another which uses a helper object - i.e Pairs and All (see mapAssertions.kt in atrium-api-cc-infix-en_GB-common for a guideline)

    • change since 0.9.0 to 0.10.0

    • convert isEmpty() to toBe Empty (see mapAssertions.kt in atrium-api-cc-infix-en_GB-common for a guideline)

    • convert isNotEmpty() to notToBe Empty

  • copy the MapAssertionsSpec.kt from atrium-api-fluent-en_GB-common to atrium-api-infix-en_GB-common

    • introduce a function in the companion object for each assertion function so that we see the infix API in action (see MapAssertionsSpec in atrium-api-cc-infix-en_GB-jvm but use fun1, fun2 etc. to retrieve the name of the function instead of KFunction<...> -- use fun1<..>(...).name)

  • copy the MapAsEntriesAssertionsSpec.kt from atrium-api-fluent-en_GB-common to atrium-api-infix-en_GB-common

    • introduce a function in the companion object for each assertion function so that we see the infix API in action (see MapAsEntriesAssertionsSpec in atrium-api-cc-infix-en_GB-jvm but use fun1, fun2 etc. to retrieve the name of the function instead of KFunction<...> -- use fun1<..>(...).name)

  • copy the MapFeatureAssertionsSpec.kt from atrium-api-fluent-en_GB-common to atrium-api-infix-en_GB-common

    • introduce a function in the companion object for each assertion function so that we see the infix API in action (see MapFeatureAssertionsSpec in atrium-api-cc-infix-en_GB-jvm but use fun1, fun2 etc. to retrieve the name of the function instead of KFunction<...> -- use fun1<..>(...).name)

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).
good first issue help wanted

Most helpful comment

I'm in a small group that will work on this

All 10 comments

I can take this one on!

@dragid10 do you need help?

Sorry I haven't had much time to work on it this past week, But I'll reach out tomorrow if I need help!

In trying to fix the Expect.contains function I am unable to use this contains Pairs(keyValuePair) while getting the message Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly

It's always easier for me to see all code to help out with a problem. Can you create a PR (pull request) please? You can suffix the title of the PR with WIP which stands for work in progress

@dragid10 could you solve your problem?

@dragid10 any progress on this one? do you need help? Un-assign you so that others can take over.

Hey @robstoll, I am unable to continue contributing for I am quite busy. I will be back when the work load reduces.

I'm in a small group that will work on this

implemented with 1c5bbb2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robstoll picture robstoll  路  4Comments

robstoll picture robstoll  路  6Comments

robstoll picture robstoll  路  3Comments

dalewking picture dalewking  路  6Comments

robstoll picture robstoll  路  3Comments