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

Align use of extension point #496

Merged
merged 33 commits into from Mar 31, 2022
Merged

Conversation

nipafx
Copy link
Member

@nipafx nipafx commented Jun 1, 2021

Closes #479.

Proposed commit message:

Align use of extension point (#479 / #496)

If an extension needs to search for enclosing elements, there are
basically two ways to do so: 

1. Combine `BeforeAllCallback`/`AfterAllCallback` with
`BeforeEachCallback`/`AfterEachCallback`.
2. Use`BeforeEachCallback`/`AfterEachCallback` and look up enclosing
elements (e.g. via
`PioneerAnnotationUtils#findClosestEnclosingAnnotation(...)`).

We agreed on approach no. 1 since it enables the use of extensions in
setup/teardown methods. This PR aligns the use of extension points to
guarantee consistent behavior across different extensions.

Closes: #479
PR: #496

PR checklist

The following checklist shall help the PR's author, the reviewers and maintainers to ensure the quality of this project.
It is based on our contributors guidelines, especially the "writing code" section.
It shall help to check for completion of the listed points.
If a point does not apply to the given PR's changes, the corresponding entry can be simply marked as done.

Documentation (general)

  • There is documentation (Javadoc and site documentation; added or updated)
  • There is implementation information to describe why a non-obvious source code / solution got implemented
  • Site documentation has its own .adoc file in the docs folder, e.g. docs/report-entries.adoc
  • Only one sentence per line (especially in .adoc files)
  • Javadoc uses formal style, while sites documentation may use informal style

Documentation (new extension)

  • The docs/docs-nav.yml navigation has an entry for the new extension
  • The package-info.java contains information about the new extension

Code

  • Code adheres to code style, naming conventions etc.
  • Successful tests cover all changes
  • There are checks which validate correct / false usage / configuration of a functionality and there are tests to verify those checks
  • Tests use AssertJ or our own PioneerAssert (which are based on AssertJ)

Contributing

  • A prepared commit message exists
  • The list of contributions inside README.md mentions the new contribution (real name optional)

I hereby agree to the terms of the JUnit Pioneer Contributor License Agreement.

@nipafx nipafx linked an issue Jun 1, 2021 that may be closed by this pull request
@nipafx
Copy link
Member Author

nipafx commented Jun 1, 2021

What's missing:

  • documenting the extension scope in their respective documentations
  • documenting the general approach in CONTRIBUTING.md
  • checking all extensions:
    • system properties and environment variables
    • default locale and time zone
  • checking means:
    • verify behavior re before/after all
    • potentially add tests for resetting

@beatngu13 beatngu13 force-pushed the issue/479-extension-points-annotations branch from 686ad4c to a7b7c28 Compare September 22, 2021 19:30
@beatngu13 beatngu13 marked this pull request as ready for review September 22, 2021 19:48
@beatngu13 beatngu13 added the full-build Triggers full build suite on PR label Sep 22, 2021
@beatngu13
Copy link
Member

@nipafx did a rebase, addressed the remaining tasks, and wrote a commit message. ✌️

Nicolai Parlog added 3 commits September 23, 2021 21:18
The described behavior is indeed what we now offer but it's actually
what could be expected from such annotations, so we don't need to
document "the obvious" (cough). Instead, we should point out the
change of behavior in the release notes.
@nipafx
Copy link
Member Author

nipafx commented Sep 23, 2021

Great work, thank you @beatngu13! I changed a few things - see commit messages.

Copy link
Member

@Bukama Bukama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, especially the addition in the docs 👍

@Bukama Bukama requested a review from beatngu13 October 7, 2021 17:00
@Bukama
Copy link
Member

Bukama commented Oct 7, 2021

@beatngu13 will have a look in when he has a quite minute

@nipafx
Copy link
Member Author

nipafx commented Oct 8, 2021

I think we wanted to model the tests of DefaulTimeZone after DefaultLocale before merging.

@nipafx nipafx removed the full-build Triggers full build suite on PR label Nov 14, 2021
@nipafx
Copy link
Member Author

nipafx commented Nov 14, 2021

At least the tests need to be aligned before this is merge-ready. Also, this conversation needs to be resolved.

Copy link
Member

@Bukama Bukama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge conflict needs to be resolved

@beatngu13
Copy link
Member

I think I did it … proposed commit message:

Align use of extension point (#479 / #496)

If an extension needs to search for enclosing elements, there are
basically two ways to do so: 

1. Combine `BeforeAllCallback`/`AfterAllCallback` with
`BeforeEachCallback`/`AfterEachCallback`.
2. Use`BeforeEachCallback`/`AfterEachCallback` and look up enclosing
elements (e.g. via
`PioneerAnnotationUtils#findClosestEnclosingAnnotation(...)`).

We agreed on approach no. 2 since it appears to be less error-prone
and cover more common use cases.

This PR aligns the use of extension points to guarantee consistent
behavior across different extensions.

Closes: #479
PR: #496

@beatngu13 beatngu13 reopened this Mar 14, 2022
Copy link
Member

@Michael1993 Michael1993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I do have a couple nitpicks about it.

Copy link
Member

@Michael1993 Michael1993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the build is platform-dependent now? How did that happen?

@beatngu13
Copy link
Member

Actually, the build is platform-dependent now? How did that happen?

I forgot this:

// we set UTC as test time zone unless it is already
// the system's time zone; in that case we use UTC+12

Apparently, the macOS job was using UTC, so the test default resulted in UTC+12. Fix:

30cca6e

@beatngu13 beatngu13 self-requested a review March 14, 2022 22:51
Copy link
Member

@Bukama Bukama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment on the comment-question, if I'm the only one who does it wrong, see this as approved.

@nipafx nipafx added the full-build Triggers full build suite on PR label Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full-build Triggers full build suite on PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enclosing classes vs Before/AfterAll
4 participants