Allow referencing the extension
See original GitHub issueJUnit 5 has a neat extensions functionality which is not compatible with kotlintest even if it runs on JUnit framework. While the simple use cases in which we just need to log something can be handled by the TestListener
, we cannot handle more advanced cases. In particular, how to interact with the extension (which seems reasonable and extremely useful)? Ideally, I would like to get a hold of the extension so I could query it.
In JUnit5 it would be (one of the options anyway)
@ExtendWith(MyExtension.class)
class Something() {
@MyAnnotation
MyType myType;
@Test
void doSomething() {
myType.doSomething();
}
}
In JUnit4 it would be even simpler
@Rule
MyRule myRule;
@Test
void fun() {
myRule.something();
}
This is useful for a variety of reasons:
- Encapsulating resource mocks along with the sets of methods to interact with them (reset etc.)
- Extracting common instantiation tasks hiding complexity from the tests - note that we could have handled it by a simple composition but then we would need to instantiate the object and later plug it into all of the lifecycle methods which is not ideal.
- More
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Extension:Cite - MediaWiki
The Cite extension allows a user to create references as footnotes on a page. It adds two parser hooks to MediaWiki, <ref> and...
Read more >How to enable Reference Search View extension
Search @builtin references in the extension view to make sure you ... This should open the references sidebar with the reference results.
Read more >10 Chrome extensions to help manage references, notes ...
Recommendations below cover tools for reference management, ... The extension also allows you to track down PDFs of the paper and export ...
Read more >Referencing Extension
On first reference, use “NC State Extension.” On subsequent references, it's fine to condense the name to “Extension,” as long as it will...
Read more >REFERENCE File Extension - ReviverSoft
The Budget In Brief Reference File is stored in the REFERENCE format and is affixed with the REFERENCE extension, and is used by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks guys, it indeed works fine. It might not be directly apparent though so I would recommend enhancing the readme to make this pattern absolutely clear.
I don’t know if that’s the OP’s exact requirement. If it is then what you said would work.