apache / druid

Apache Druid: a high performance real-time analytics database.
https://druid.apache.org/
Apache License 2.0
13.5k stars 3.7k forks source link

JUnit4 to JUnit5 migration #13948

Open UngureanuSerg opened 1 year ago

UngureanuSerg commented 1 year ago

Hi team,

A proposal to moving on after the adoption of java8+ is to start the migration from junit4 to jnuit5.

As a strategy for the approach I would suggest to migrate one module at a time(it will be easier for the prs) and create tasks for the rest of the modules. As a starting point we can still depend on JUnit Vintage for backward compatibility with JUnit 4 but gradually moving to JUnit5.

I think all the point mentioned describes why it would be beneficial for apache druid as well as I would like to pick this issue if the rest of the community is interested.

cryptoe commented 1 year ago

@UngureanuSerg Thanks for starting this. Yes lets start the migration. Pretty excited 🚀 . IMHO JUnit Vintage should be our last option. If we are able to move to the JUnit 5 using Unit Platform dependencies that would be even cooler.

gianm commented 1 year ago

@UngureanuSerg Thanks for starting this. Yes lets start the migration. Pretty excited 🚀 . IMHO JUnit Vintage should be our last option. If we are able to move to the JUnit 5 using Unit Platform dependencies that would be event cooler.

I don't know the details, but if "JUnit Vintage" allows us to do a migration piece-by-piece instead of updating every test case at once, that sounds like a good thing. Updating every test case at once could potentially be a prohibitive amount of work for a single contributor.

UngureanuSerg commented 1 year ago

Hey Gian I didn't know that junit-vintage give this kind of capabilities but I will check it for sure

dampcake commented 1 year ago

In other projects I use junit-vintage to mix both JUnit5 and JUnit4 tests in the same suites. This allows for new tests or tests where you want to take advantage of the features to be converted while leaving all the existing tests on Junit4. Pretty much a best of both worlds scenario.

kgyrtkirk commented 1 month ago

there was a related PR to this: #16106 ;

I would like to leave a note here: to make sure that future PRs upgrading to junit5 should also configure openrewrite via rewrites.yml to ensure that no junit4 starts getting back into the upgraded testclasses (configuring that first and running the rewrite engine could jump-start the migration process as well)