Annotations like @SetSystemProperty are not inherited
See original GitHub issueThe following test fails:
@SetSystemProperty(key = "set prop A", value = "new A")
class SuperClass { }
@Nested
class TestClass extends SuperClass {
@Test
void shouldSetSystemPropertyToValue() {
assertThat(System.getProperty("set prop A")).isEqualTo("new A");
}
}
Unless I’m missing something, it stands to reason that it should pass because it should inherit the annotation from the super class. Am I missing something?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Inherited annotation is not being inherited - Stack Overflow
After adding the annotation @DocAnnotation("Super Annotation") to SubClass (that's the same one as in SuperClass ) it actually shows up twice, ...
Read more >Clearing or Setting System Properties - JUnit Pioneer
Both annotations work on the test method and class level, are repeatable, combinable, and inherited from higher-level containers. After the annotated method has ......
Read more >Inherited Annotations in Java - GeeksforGeeks
@inherited is a type of meta-annotation used to annotate custom annotations so that the subclass can inherit those custom annotations.
Read more >picocli - a mighty tiny command line interface
When running on Java 6 or higher, the user input is not echoed to the console. After the user enters a password value...
Read more >JUnit 5 User Guide
Such annotations are not inherited. @Tag. Used to declare tags for filtering tests, either at the class or method level; analogous to test...
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 FreeTop 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
Top GitHub Comments
This should be a very simple fix, no? Just add the missing
@Inherited
annotation on our annotations. Or am I missing something?Part of the solution for this should include tests that verify the new behaviour.