question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should SystemPropertyExtension use closest or enclosing annotations

See original GitHub issue

In stream and while discussing (the already merged) #187 we were thinking about following thing:

At the moment the SystemPropertyExtension only looks for the closest annotation. When @nicolaiparlog was doing #187 he kept it that way to keep the tests passing, but we both asked ourself if that’s the correct way the extension should work or if it should also take the enclosing annotations into account.

Note: The current docs say to only use closest, but of course they “only” fit to current implementation.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
Hancho2009commented, Apr 24, 2020

This also effects EnvironmentVariableExtension because both extensions should probably operate equally in that regards #180

1reaction
beatngu13commented, May 31, 2020

AbstractEntryBasedExtension probably should serve as a central place to control the annotation processing, like I said here:

Note that subclasses of AbstractEntryBasedExtension are currently responsible for discovering their own annotations. In a second step, we might move additional code into AbstractEntryBasedExtension. However, for now I think the way it is implemented is already a good improvement.

This way, we get consistent behavior for all subclasses such as SystemPropertyExtension and EnvironmentVariableExtension.

I am not sure if I would go for stuff like @IgnoreSetOrClearSystemProperty. This can make things really complicated, both from a maintainer and a user perspective. And one can easily achieve the desired behavior with what we already have.

I would suggest to look into similar extensions in Jupiter and—if applicable—try to copy their behavior, such that users get consistent behavior across the JUnit universe.

Thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reduce duplication · Issue #180 · junit-pioneer/junit ... - GitHub
EnvironmentVariableExtension and SystemPropertyExtension are basically ... Should SystemPropertyExtension use closest or enclosing annotations #222.
Read more >
index all classes all packages - junit-pioneer 1.9.1 javadoc
The boolean values to use as sources of arguments; must not be empty. ... findClosestEnclosingRepeatableAnnotations(ExtensionContext, Class<A>) - Static ...
Read more >
Properly set (system) properties in JUnit 5 - Stack Overflow
Both annotations work on the test method and class level, are repeatable as well as combinable. After the annotated method has been executed, ......
Read more >
JUnit 5 User Guide
The default orderer will be used for all tests unless the @TestMethodOrder annotation is present on an enclosing test class or test interface....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found