Atrium: mapEntryAssertions for the new infix API

Created on 18 Oct 2019  路  13Comments  路  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 mapEntryAssertions.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 mapEntryAssertions.kt in atrium-api-cc-infix-en_GB-common for a guideline)

    • use Pair for isKeyValue instead of two parameters (see mapEntryAssertions.kt in atrium-api-cc-infix-en_GB-common for a guideline)

  • copy the MapEntryAssertionsSpec.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 MapEntryAssertionsSpec 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 MapEntryFeatureAssertionsSpec.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 MapEntryFeatureAssertionsSpec 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

All 13 comments

Hi Rob, could you assign this to me?

Hi Rob, I haven't made as much progress on this one as I would have liked. I am having a lot of trouble with the MapEntryAssertionsSpec class. I have been reading about reflection inside of Kotlin. It is my understanding that the line "fun2(Expect>::isKeyValue)" passes in a function reference of "isKeyValue" to the testing class. Within the companion object I am confused about how to use "isKeyValue" function. Any further reading material or tips would be greatly appreciated.

Your understanding is correct Expect<Map.Entry<String, Int>>::isKeyValue gets a function reference. Maybe the confusion comes from fun2? fun2 is a helper function to do two things, get the name of a function (out of the given KFunction) and use the function as such (KFunction as lambda). Further tips are given in the review

I am fairly stuck on this issue and won't have a lot of time in the next month to work on this so I believe it would be best if this was reassigned

No worries, I'll merge your PR into a different branch tomorrow and take over. Thanks for what is already done :)

Really appreciate all of the guidance sorry I couldn't be more help

Come back once you have more time again, your contribution is always welcome and I am happy to help out.

In case someone want to take over the work from @npswedberg base your PR on the branch #267-map-entry-new-infix-api

I'll take over

the branch #267-map-entry-new-infix-api is quite outdated, maybe it is easier to just have a look at it but start off with a new branch

Ok

implemented with a1617fb

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robstoll picture robstoll  路  6Comments

robstoll picture robstoll  路  4Comments

robstoll picture robstoll  路  4Comments

robstoll picture robstoll  路  3Comments

robstoll picture robstoll  路  6Comments