Sounds like a good idea. I'm planning on upgrading to Junit 5 in Commons 
Imaging too as we have another issue to improve the current tests and how they 
load test files.

+1 

    On Thursday, 23 May 2019, 4:43:59 am NZST, Heinrich Bohne 
<heinrich.bo...@gmx.at> wrote:  
 
 Right now, commons-numbers is using JUnit 4.12, the last stable version
of JUnit 4. As far as I am aware, there is no explicit syntax in JUnit
4.12 for testing whether an exception is thrown apart from either using
the deprecated class ExpectedException or adding the "expected"
parameter to the Test annotation. The problem with the latter approach
is that it is impossible to ascertain where exactly in the annotated
method the exception is thrown – it could be thrown somewhere unexpected
and the test will still pass. Besides, when testing the same exception
trigger with multiple different inputs, it is impractical to create a
separate method for each test case, which would be necessary with both
aforementioned approaches.

This has led to the creation of constructs where the expected exception
is swallowed, which has been deemed undesirable
<https://issues.apache.org/jira/browse/NUMBERS-99?focusedCommentId=16843419&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16843419>.
Because of this, I propose to add JUnit 5 as a dependency in
commons-numbers. JUnit 5 has several "assertThrows" methods that would
solve the described dilemma.  

Reply via email to