junit5 icon indicating copy to clipboard operation
junit5 copied to clipboard

Document best practices for implementing ParameterResolvers

Open sbrannen opened this issue 8 years ago • 10 comments

Overview

Based on discussions in #1184 and https://github.com/weld/weld-junit/issues/3, it is apparent that we need to document best practices for implementing ParameterResolver, particularly with regard to "playing nicely" with other registered ParameterResolver implementations.

Proposed Categories

After having put a bit more thought into the subject, I am tossing around the idea of categorizing ParameterResolver implementations by behavior as follows.

  • explicit: support requires an annotation for disambiguation.
  • implicit: support is automatic for types owned by the resolver.
  • speculative: a resolver claims it can support a given parameter even if it potentially should not (a.k.a., greedy or eager).

Deliverables

  • [ ] Document best practices for ParameterResolver implementations in JavaDoc.
    • more succinct than the documentation in the User Guide
  • [ ] Document best practices for ParameterResolver implementations in the User Guide.
    • including examples and explanations of how to avoid conflicts

sbrannen avatar Nov 28 '17 16:11 sbrannen

Update: added Proposed Categories section to issue.

sbrannen avatar Nov 30 '17 13:11 sbrannen

Can you also provide examples for error/exception handling within ParameterResolver which are actually not ParameterResolutionExceptions (i.e. resolveParameter() reads a File where an IOException is thrown)?

rumpfc avatar Dec 15 '17 10:12 rumpfc

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. Thank you for your contribution.

stale[bot] avatar May 13 '21 21:05 stale[bot]

This issue has been automatically closed due to inactivity. If you have a good use case for this feature, please feel free to reopen the issue.

stale[bot] avatar Jun 03 '21 22:06 stale[bot]

Hey @marcphilipp @sbrannen, can you please re-open this issue? I think it's still relevant, as right now it's not clear how to develop a ParameterResolver that doesn't conflict with other parameter resolvers, and in particular to create one that doesn't conflict with ParameterizedTest. I'm also willing to help with the review of the doc.

My use case is that I want to create a test matrix combining several TestTemplateInvocationContextProvider, in particular my own ParameterResolver (injected through an implementation of TestTemplateInvocationContextProvider) and @ParameterizedTest.

slinkydeveloper avatar Mar 29 '22 14:03 slinkydeveloper

can you please re-open this issue? I think it's still relevant, as right now it's not clear how to develop a ParameterResolver that doesn't conflict with other parameter resolvers,

Sure. I'll reopen this issue.

and in particular to create one that doesn't conflict with ParameterizedTest.

That aspect is already covered in the current documentation.

sbrannen avatar Mar 29 '22 14:03 sbrannen

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. Thank you for your contribution.

stale[bot] avatar Mar 29 '23 20:03 stale[bot]

Closing due to lack of requested feedback. If you would like to proceed with your contribution, please provide the requested information and we will re-open this issue.

stale[bot] avatar Apr 20 '23 12:04 stale[bot]

PR for this issue had some formatting violations, now fixed.

jabhatfield avatar May 23 '24 15:05 jabhatfield

Hi @sbrannen, I've created a PR for this issue.

jabhatfield avatar Jun 03 '24 12:06 jabhatfield