[JUnit 4.13 regression] @BeforeClass shadowing in superclass doesn't work
See original GitHub issueIn JUnit 4.13 version the @BeforeClass
method of superclass is run even if it is shadowed by current class, which is not as expected according to current JUnit 4.12 behaviour and @BeforeClass
javadoc:
The "@BeforeClass" methods of superclasses will be run before those of the current class,
unless they are shadowed in the current class.
Repro code:
class Junit413RegressionSuperclass {
@BeforeClass
public static void beforeAll() {
System.out.println("beforeAll - superclass");
}
}
public class Junit413Regression extends Junit413RegressionSuperclass {
@BeforeClass
public static void beforeAll() {
System.out.println("beforeAll - class");
}
@Test
public void test() {
System.out.println("test - class");
}
}
Expected output (JUnit 4.12):
beforeAll - class
test - class
Actual output (JUnit 14.13-SNAPSHOT):
beforeAll - superclass
beforeAll - class
test - class
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (12 by maintainers)
Top Results From Across the Web
TestNG @BeforeClass doesn't run from super class if it not an ...
The problem is you have the same method name between A and B. When TestNG is looking for configuration methods, it won't find...
Read more >Bug List
Chandra, RESO, FIXE, JUnit Launch configuration dialog selects JUnit3 while ... [extract superclass] should also work on types without methods, 2006-04-04.
Read more >HBASE Changelog - Google Git
HBASE-22146, SpaceQuotaViolationPolicy Disable is not working in Namespace level ... HBASE-23664, Upgrade JUnit to 4.13, Minor, integration tests, test.
Read more >JIRA - Gradle
Key Summary Assignee Reporter
GRADLEREV‑7 Rename 'empty' build type Luke Daley Adam Murdoch
GRADLEREV‑8 Needs a mention in the release notes. Luke Daley Adam Murdoch
GRADLEREV‑9...
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
To make things concrete, here’s one possible fix:
https://github.com/junit-team/junit4/commit/5ef2b8de3d751b7e06cf81dcbf64a155fe490e0a
Sent out #1514
This change only affects static methods. The behavior of non-static methods is subtlety different in 4.13 due to the fixes for bridge methods.