When implementing JUnit4 testcases I noticed that ExpectedException.none() is deprecated.
I know that @Rule etc. has to be changed when porting testing code to JUnit5, but can anybody say whether the none() method can be still used as long as JUnit4?
In addition I am a bit curious why ExpectedException.none() has been deprecated.
Some note about the given case: it's not me who will decide about the time when to port this to JUnit5. If the abovementioned construct will be invalid still in JUnit4 time the only alternative I see would be to go back to stone age thus. JUnit3:
I never said it was invalid. Both ExpectedException and assertThrows work in JUnit 4.13. You can keep using the deprecated code, and replace it gradually with assertThrows. The switch to JUnit 5 is still pretty big, it took me a few hours to migrate just a few small projects. That was mostly due to @Test(expected = ...) and ExpectedException and replacing them with assertThows. The other major issues I had were:
The replacement of Runners with Extensions. Both Spring and Mockito (two out of three Runners I've used most often) have Extensions as well.
The way parameterized tests are executed. Parameterization no longer occurs per class (using the Parameterized Runner), but per method with either @ParameterizedTest or using dynamic tests with @TestFactory.
So sticking with JUnit 4 is not a bad thing for existing projects. Just don't go back to JUnit 3 constructs, that will really hurt you in the end. The upgrade to JUnit 5 can come at any time. I do suggest using JUnit 5 for new projects from the start though.