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

Path.toBeAnEmptyDirectory #766

Closed
8 tasks
robstoll opened this issue Jan 2, 2021 · 7 comments · Fixed by #831 or #832
Closed
8 tasks

Path.toBeAnEmptyDirectory #766

robstoll opened this issue Jan 2, 2021 · 7 comments · Fixed by #831 or #832
Assignees
Labels
Milestone

Comments

@robstoll
Copy link
Owner

robstoll commented Jan 2, 2021

Platform (all, jvm, js): all
Extension (none, kotlin 1.3): none

Code related feature

expect(path).toBeAnEmptyDirectory()

//instead of

expect(path)
  .toBeADirectory()
  .feature("findFirstFile", { Files.list(this).use { it.findFirst() } }) {
    isEmpty()
  }

Following the things you need to do:

logic

  • extend PathAssertions with a function toBeEmptyDirectory (see other functions as a guideline)
  • implement toBeEmptyDirectory in DefaultPathAssertions.kt -- bonus use newDirectoryStream instead and list all files as failureHint in case the iterator.hasNext()

api-fluent

  • provide a fun toBeAnEmptyDirectory in a new file called pathExpectations.kt (see for instance isDirectory in pashAssertions.kt as a guideline)
  • add @since 0.16.0 (adapt to current milestone) to KDOC
  • add toBeAnEmptyDirectory to PathExpectationsSpec in specs-common adopt the spec in api-fluent

api-infix

  • provide a fun toBe which expects anEmptyDirectory in a new file called pathExpectations.kt (see toBe aDirectory in pathAssertions.kt as a guideline)
  • add @since 0.16.0 (adapt to current milestone) to KDOC
  • add toBeAnEmptyDirectory to PathExpectationsSpec in specs-common adopt the spec in api-infix

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).
@Samuellucas97
Copy link

I'll work on this

@robstoll
Copy link
Owner Author

@Samuellucas97 I have updated the description. Let me know in case you need help

@robstoll
Copy link
Owner Author

@Samuellucas97 let us know in case you need help

@mai2412
Copy link
Contributor

mai2412 commented Mar 6, 2021

I'd like to try this, toBeEmptyDirectory simply asserts whether the path points to an empty directory, correct?

@robstoll
Copy link
Owner Author

robstoll commented Mar 6, 2021

@mai2412 exactly. Use the existing functionality for toBeADirectory so that the reporting in error cases is already advanced

@mai2412
Copy link
Contributor

mai2412 commented Mar 6, 2021

Do you mean isDirectory? I can't find toBeADirectory

@robstoll
Copy link
Owner Author

robstoll commented Mar 7, 2021

@mai2412 yes, isDirectory in DefaultPathAssertions. Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment