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

shortcut for Path.fileName.toString #109

Closed
robstoll opened this issue Jul 23, 2019 · 6 comments
Closed

shortcut for Path.fileName.toString #109

robstoll opened this issue Jul 23, 2019 · 6 comments
Assignees
Milestone

Comments

@robstoll
Copy link
Owner

robstoll commented Jul 23, 2019

Platform (JVM, JS and/or Android): jdk8

Code related feature

expect(Paths.get("xyz.txt")).fileName.startsWith(...) // instead of
expect(Paths.get("xyz.txt")).feature("file name") { fileName.toString() }

// and
expect(Paths.get("xyz.txt")).fileName {
  startsWith(...) 
  contains(...)
  endsWith(".txt")
}
// instead of
expect(Paths.get("xyz.txt")).feature("file name", { fileName.toString() }) {
  startsWith(...) 
  contains(...)
  endsWith(".txt")
}

Following the things you need to do:

domain

  • extend PathAssertions with a function fileName (see CollectionAssertions.size as a guideline):
  • modify PathAssertionsBuilder, delegate to pathAssertions (see CollectionAssertionsBuilder as a guideline)
  • delegate implementation to robstoll-lib in PathAssertionsImpl (see CollectionAssertionsImpl as a guideline)

lib

  • implement the _fileName (see collectionAssertions.kt as a guideline)
    • you might have to introduce DescriptionPathAssertion in translations-en_GB and translations_de_CH
    • add FILE_NAME("file name")to DescriptionPathAssertions for en_GB
    • add FILE_NAME("Dateiname") to DescriptionPathAssertions for de_CH

api

  • provide a val which returns Expect (see collectionAssertions.kt => size as a guideline) and @since 0.9.0 (adopt to current version) to the KDOC
  • provide a fun which expects an assertionCreator lambda and returns Expect (where T: Path -- see lcollectionAssertions.kt => size as a guideline) and @since 0.9.0 (adopt to current version) to the KDOC
  • write a separate Spec named PathFeatureAssertionsSpec in specs-common (see for instance ListFeatureAssertionsSpec) 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).
@Tregz
Copy link
Contributor

Tregz commented Oct 6, 2019

I'll work on this

@Tregz
Copy link
Contributor

Tregz commented Oct 10, 2019

I'll work on this

@robstoll This is my first contribution. I am familiar with Kotlin. I started dev of mobile app last year. I cloned the project with IDEA. I do not yet understand well all of what is done in this project, so I followed the steps for this contribution. I edited the jvm files. I added the PathFeatureAssertionsSpec. Could you give me hint about what PathFeatureAssertionsSpec must achieve?

Tregz pushed a commit to Tregz/atrium that referenced this issue Oct 10, 2019
Tregz pushed a commit to Tregz/atrium that referenced this issue Oct 10, 2019
Tregz pushed a commit to Tregz/atrium that referenced this issue Oct 10, 2019
Tregz pushed a commit to Tregz/atrium that referenced this issue Oct 10, 2019
@robstoll
Copy link
Owner Author

@Tregz I reviewed your PR, see comments there. The PathFeatureAssertionsSpec shall prove that your implementation is correct. I assume you already guessed that and hence I am unsure what your question really is 🙂

@Tregz
Copy link
Contributor

Tregz commented Oct 10, 2019

@robstoll The implementation test fail when I push. Can I run the test myself? I do not know how to config this project to run debug. I cloned the project with IDEA.

@robstoll
Copy link
Owner Author

Have you installed the spek framework plugin? If not, please have a look at Your first code contribution) With this in place you can run single tests in intellij. Otherwise you can use gradle to run tests: ./gr build builds the whole project (on windows its gr build)

@Tregz
Copy link
Contributor

Tregz commented Oct 10, 2019

Ah, thanks! I'm installing Spek Framework.

@robstoll robstoll added this to the 0.9.0 milestone Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants