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

accept date as string in ISO 8601 format for ChronoLocalDate #480

Closed
9 tasks
robstoll opened this issue Apr 28, 2020 · 3 comments · Fixed by #571
Closed
9 tasks

accept date as string in ISO 8601 format for ChronoLocalDate #480

robstoll opened this issue Apr 28, 2020 · 3 comments · Fixed by #571
Assignees
Milestone

Comments

@robstoll
Copy link
Owner

robstoll commented Apr 28, 2020

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

Code related feature

expect(LocalDate.now()).isAfter("2020-04-28")

//instead of

expect(LocalDate.now()).isAfter(LocalDate.of(2020,4,28))

Following the things you need to do:

atrium-logic:

  • duplicate each method in ChronoLocalDateAssertions and:
    • accept a String instead of a ChronoLocalDate and parse it to LocalDateTime and pass it to the existing overload, accept only yyyy-mm-dd and not the alternative yyyymmdd (slight deviation of ISO 8601 but already implemented like that in the jdk)

api-fluent

  • duplicate each method in chronoLocalDateAssertions.kt and:
    • accept a String instead of a ChronoLocalDate - call the corresponding logic function
    • change since to 0.14.0 (adopt to current milestone)
  • create ChronoLocalDateAsStringAssertionSpec by copying ch.tutteli.atrium.specs.integration.ChronoLocalDateTimeAsStringAssertionSpec and adapt it, it should cover the following cases for a wrong format:
    • one passes a date in format yyyymmdd
    • one passes a date in format yyyy-m-dd
    • one passes a date in format yyyy-mm-d
    • one passes a date in format yy-mm-dd
    • one passes a date in format yyyy-mm-ddThh:mm
  • adopt ChronoLocalDateAssertionsSpec (see ch.tutteli.atrium.api.fluent.en_GB.ChronoLocalDateTimeAssertionSpec as a guideline)
    • add an object ChronoLocalDateAsStringSpec which extends the above copied spec
    • add the string version to the ambiguityTests

api-infix

  • same same but different

Hint
Have a look at the following PR for ChronoLocalDateTime:
https://github.com/robstoll/atrium/pull/556/files

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).
assaflei pushed a commit to assaflei/atrium that referenced this issue May 15, 2020
introduce typealias CharSequenceOrNumberOrChar for Any

move CharSequenceOrNumberOrChar to domain-api and use in domain-impl

update setup instructions for the new infix API

include the new infix API to be published

preparation for accepting String instead of Zoned/LocalDate(Time) object

preparation for robstoll#480, robstoll#481 and robstoll#482

refer to current milestone in good_first_issue template

fix link for nullableContainer

return empty message in case callee is org.spekframework.ide

reduce code duplication also for jvm specs, add more cases to PathSpec

fix wrong replacements and workaround KT-38721 (add import next to star)

api-fluent work done

commiting requested changes

updated with comments

adding problematic classes which break the build

adding problemtic code to server to reproduce error

reproducing problematic build on CI

fix to build problem

addressing latest comment, build should pass

adjust the pseudo-keyword from exist to existing

moved infix jdk8 extension to jvm module

rebasing
assaflei pushed a commit to assaflei/atrium that referenced this issue May 15, 2020
introduce typealias CharSequenceOrNumberOrChar for Any

move CharSequenceOrNumberOrChar to domain-api and use in domain-impl

update setup instructions for the new infix API

include the new infix API to be published

preparation for accepting String instead of Zoned/LocalDate(Time) object

preparation for robstoll#480, robstoll#481 and robstoll#482

refer to current milestone in good_first_issue template

fix link for nullableContainer

return empty message in case callee is org.spekframework.ide

reduce code duplication also for jvm specs, add more cases to PathSpec

fix wrong replacements and workaround KT-38721 (add import next to star)

api-fluent work done

commiting requested changes

updated with comments

adding problematic classes which break the build

adding problemtic code to server to reproduce error

reproducing problematic build on CI

fix to build problem

addressing latest comment, build should pass

adjust the pseudo-keyword from exist to existing

moved infix jdk8 extension to jvm module

rebasing
robstoll added a commit that referenced this issue May 15, 2020
* build windows also against JDK 11

introduce typealias CharSequenceOrNumberOrChar for Any

move CharSequenceOrNumberOrChar to domain-api and use in domain-impl

update setup instructions for the new infix API

include the new infix API to be published

preparation for accepting String instead of Zoned/LocalDate(Time) object

preparation for #480, #481 and #482

refer to current milestone in good_first_issue template

fix link for nullableContainer

return empty message in case callee is org.spekframework.ide

reduce code duplication also for jvm specs, add more cases to PathSpec

fix wrong replacements and workaround KT-38721 (add import next to star)

api-fluent work done

commiting requested changes

updated with comments

adding problematic classes which break the build

adding problemtic code to server to reproduce error

reproducing problematic build on CI

fix to build problem

addressing latest comment, build should pass

adjust the pseudo-keyword from exist to existing

moved infix jdk8 extension to jvm module

rebasing

* added file deprecation suppress message + removed niok and kbox references

* resolving comments in re
@Valefant
Copy link
Collaborator

Valefant commented Sep 2, 2020

I'll work on this one

@Valefant
Copy link
Collaborator

Valefant commented Sep 2, 2020

The functions in domain-robstoll-lib are deprecated.
In that case I would extend atrium-logic-jvm further, to accept also a String.
Is that ok?

@robstoll
Copy link
Owner Author

robstoll commented Sep 2, 2020

Correct, I have updated the description.

@robstoll robstoll linked a pull request Sep 8, 2020 that will close this issue
@robstoll robstoll added this to the 0.14.0 milestone Sep 8, 2020
robstoll added a commit that referenced this issue Sep 9, 2020
…chronolocaldate

Accept a string for ChronoLocalDate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants