Atrium: shortcut for LocalDate(Time) and ZonedDateTime.day

Created on 3 Oct 2019  路  11Comments  路  Source: robstoll/atrium

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

Code related feature

expect(LocalDate.now).day.toBe(3)
expect(LocalDate.now).day {
  isLessThan(20)
  ...
}

expect(LocalDateTime.now).day.toBe(2019)
expect(LocalDateTime.now).day {
  isLessThan(20)
  ...
}

expect(ZonedDateTime.now).day.toBe(2019)
expect(ZonedDateTime.now).day {
  isLessThan(20)
  ...
}

//instead of

expect(LocaleDate.now).feature { f(it::dayOfMonth) }.toBe(3)
expect(LocaleDate.now).feature({ f(it::dayOfMonth) }) {
  isLessThan(2020)
  ...
}

...

Following the things you need to do (same same but different for LocaleDateTime and ZonedDateTime):

domain

  • extend LocalDateAssertions with a function day (see CollectionAssertions.size as a guideline)
  • modify LocalDateAssertionsBuilder, delegate to LocalDateAssertions (see CollectionAssertionsBuilder as a guideline)
  • delegate implementation to robstoll-lib in LocalDateAssertionsImpl (see CollectionAssertionsImpl as a guideline)

lib

  • implement _day in localDateAssertions by using the ExpectImpl.feature.manual (see collectionsAssertions -> size as a guideline)

    • add DAY("day") to DescriptionDateTimeLikeAssertion for en_GB

    • add DAY("Tag") to DescriptionDateTimeLikeAssertion for de_CH

api (fluent-en_GB/extensions/jdk8)

  • provide a val which returns Expect (see collectionAssertions.kt as a guideline)
  • provide a fun which expects an assertionCreator-lambda and returns Expect (see collectionAssertions.kt as a guideline)
  • extend or write a separate Spec named LocalDateFeatureAssertionsSpec in specs-common (see for instance CollectionFeatureAssertionsSpec) 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).
good first issue help wanted

All 11 comments

Hi @robstoll I'll work on this.

@ahmadrosid I forgot to merge the preparation for this task. Could you please rebase onto master (or delete the fork and fork again)

Yes @robstoll no problem. I will fork again.

@ahmadrosid please rebase on master (in case you haven't done this before: https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request). The shortcut for year was added by now (you might want to have a look at the pull request #182 in case you are stuck).

@ahmadrosid do you need any help?

I'll work on this?

@leelanakka I am not entirely sure if @ahmadrosid has given up or is still working on it. You can start as well though. In the worst case you are doing the same.

@leelanakka do you need any help? I un-assign you again, so that others can take up if they like. Write here so that others know that you still work on it.

I've pushed the code, can you reassign that to me?
let me know in case anything needs to be done

@robstoll I am working on it. Will raise PR soon.

Implemented with #275

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robstoll picture robstoll  路  6Comments

robstoll picture robstoll  路  6Comments

robstoll picture robstoll  路  4Comments

robstoll picture robstoll  路  3Comments

robstoll picture robstoll  路  4Comments