commons-net icon indicating copy to clipboard operation
commons-net copied to clipboard

Work in progress: JUnit 5 migration

Open DamnedElric opened this issue 2 years ago • 3 comments

This is not done yet, it's currently intended as a proof of concept for migrating tests to JUnit 5

DamnedElric avatar Mar 04 '24 21:03 DamnedElric

Hi @DamnedElric What is the status?

garydgregory avatar Mar 15 '24 12:03 garydgregory

Hi @garydgregory ,

I'll quote what I said on the mailing list, but the TL;DR; is that I'm awaiting feedback, and that I'll try to make some more progress.

Following Rob's suggestion, I migrated FTPSClientTest from @Parameterized to @Nested

The result so far can be found here: https://github.com/apache/commons-net/pull/227/commits/b14ee39cca486bda106758a48d31c91ad52d0d83

Basically the test methods were moved from FTPSClientTest.java [1] to AbstractFtpsTest.java [2]. The two @Parameterized values are then injected using @Nested.

The behaviour in maven is exactly the same as before. The behaviour in Eclipse bugs me a little, instead of running both nested tests by default, it asks which one should be executed. But that seems to be the case with @Nested tests in general.

[1] https://github.com/apache/commons-net/blob/b14ee39cca486bda106758a48d31c91ad52d0d83/src/test/java/org/apache/commons/net/ftp/FTPSClientTest.java

[2] https://github.com/apache/commons-net/blob/b14ee39cca486bda106758a48d31c91ad52d0d83/src/test/java/org/apache/commons/net/ftp/AbstractFtpsTest.java

Any feedback is welcome. I personally feel like this test case is a bit too complex to be easily grokked, and perhaps it can be improved a bit more after the JUnit migration.

DamnedElric avatar Mar 16 '24 19:03 DamnedElric

Yeah, I don't use the Nested feature. Eclipse behavior is important to me, I want that to work as well as it can...

garydgregory avatar May 04 '24 17:05 garydgregory