HBASE-29876 Upgrade hbase-shell to use junit5#7752
HBASE-29876 Upgrade hbase-shell to use junit5#7752Apache9 merged 2 commits intoapache:branch-2.5from
Conversation
| @BeforeEach | ||
| public void setUpEach() throws Exception { |
There was a problem hiding this comment.
Hi, @Apache9
During the migration from Junit4 to Junit5, I discovered that the BeforeClass initialization method subclass with the same name in Junit4 would override the parent class. However, in Junit5, the subclass does not directly override the parent class. Instead, the parent class is executed first, followed by the subclass, which leads to method incompatibilities (such as the possibility of starting both MiniClusters, resulting in failure).
For example, in TestChangeSftShell and TestRSGroupShell, I believe there may be similar issues in other parts of the HBase codebase.
Here, we modified BeforeClass to BeforeEach and overridden it in the subclass. Since we only have one unit test method at most, how can we minimize modifications when there are many unit test methods? Do you have any suggestions, thanks!
There was a problem hiding this comment.
Better to only add BeforeAll AfterAll annotations in sub classes, and make sub classes call static method in the parent class.
There was a problem hiding this comment.
Better to only add BeforeAll AfterAll annotations in sub classes, and make sub classes call static method in the parent class.
Got it, thanks!
CC: @Apache9