Atrium: CharSequence.matches

Created on 2 Oct 2019  路  2Comments  路  Source: robstoll/atrium

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

Code related feature

expect("hello").matches(Regex("([hH]ello"))

which should result in reporting

expect: "hello World"       (String<987383>)
* matches entirely: [hH]ello     (Regex<123423>)

This assertion function matches the entire CharSequence in contrast to expect("hello").containsRegex(...), ergo it fails if it contains a match only within the CharSequence.

Following the things you need to do:

domain

  • extend CharSequenceAssertions with a function matches which expects a Regex (see other functions as a guideline but use Expect instead of SubjectProvider)
  • modify CharSequenceAssertionsBuilder, delegate to charSequenceAssertions (see other functions as a guideline)
  • delegate implementation to robstoll-lib in CharSequenceAssertionsImpl (see other functions as a guideline)

lib

  • implement _matches in charSequenceAssertions

    • add MATCHES("matches entirely") to DescriptionCharSequenceAssertion for en_GB

    • add MATCHES("stimmt vollst盲ndig 眉berein mit") to DescriptionCharSequenceAssertion for de_CH

api (only fluent-en_GB)

  • provide the fun matches (see other assertion functions in charSequenceAssertions.kt)
  • extend CharSequenceAssertionsSpec in specs-common (see for instance YzFeatureAssertionsSpec) and extend it in atrium-api-fluent-en_GB-common/src/test

    • include a test case where there is a match within the CharSequence

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 hacktoberfest help wanted

All 2 comments

I'll work on this

@mikemolenda in case you already started with the implementation. I have removed the overload which expects only a String. I am not yet 100% sure if it is a good idea to add it. Let's start with Regex only

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robstoll picture robstoll  路  5Comments

robstoll picture robstoll  路  5Comments

robstoll picture robstoll  路  6Comments

robstoll picture robstoll  路  3Comments

robstoll picture robstoll  路  4Comments