netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

remove usages of deprecated junit.framework.Assert.

Open mbien opened this issue 3 years ago • 0 comments

project wide cleanup which intends to:

  • get rid of many build log warnings
  • reduce the mixing of two junit APIs

The annoying part is that junit 4 made the decision of simply throwing java.lang.AssertionError in Assert.* (and i forgot about that), while junit 3 and 5 throw a subtype, so that it is possible to distinguish between language level assert and test Assert. Further, NBTestCase extends TestCase which extends the deprecated Assert.

So i did the following:

  • if it doesn't extend NBTestCase use org.junit.Assert
  • unless any of the tests catch AssertionFailedError (there are not many instances, second commit), then we use junit.framework.TestCase.* which is essentially what NBTestCase uses (but there won't be deprecation warnings), since catching AssertionError might break tests in non obvious ways

This should hopefully clean things up without making it harder to migrate to junit 5 in future.

mbien avatar Jul 22 '22 21:07 mbien