commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Herbert <alex.d.herb...@gmail.com>
Subject Re: [statistics] Upgrade to JUnit 5
Date Sat, 15 Jun 2019 12:58:18 GMT

> On 13 Jun 2019, at 18:15, Alex Herbert <alex.d.herbert@gmail.com> wrote:
> 
> [numbers] is currently upgrading to JUnit 5. This has progressed quite efficiently with
a few branch merge issues.
> 
> I suggest an upgrade of [statistics] before it expands in scope.
> 
> It has no @RunWith(value = Parameterized.class) requirements and so should be a straight
forward conversion.
> 
> Alex
> 

I’ve put a straight forward conversion to JUnit 5 in PR 16 [1].

The @Before annotations have to be replaced with @BeforeEach.

This is used in the abstract distribution test classes for a setUp() method to create all
the data to test the distributions. Concrete test classes sometimes override setUp() to set
the test tolerance. Strangely the override of the method does not work and none of the test
data is created and lots of NPEs occur. I do not know what JUnit is doing but it appears not
to call the @BeforeEach annotated method as expected using the inheritance chain.

The solution was to not override the method but to put new @BeforeEach methods in the concrete
classes that extend the abstract base class. JUnit ensures that all @BeforeEach methods in
super classes are called before those in child classes. The effect is the same as before (data
is created by the abstract class method and then the tolerance can be configured in the child
class) and the test suite runs all tests.

Travis fails on running OracleJDK. 8 This is unrelated and due to Travis not being able to
set up the oraclejdk8 environment. This appears to happen periodically when Oracle change
the download URL. It may be due to a licence change from Oracle preventing downloads of the
JDK without logging in. I cannot find a definite answer but problems have been flagged on
Travis xenial builds using oraclejdk8 as of 16 Apr 2019 [2].

[1] https://github.com/apache/commons-statistics/pull/16 <https://github.com/apache/commons-statistics/pull/16>
[2] https://travis-ci.community/t/install-of-oracle-jdk-8-failing/3038 <https://travis-ci.community/t/install-of-oracle-jdk-8-failing/3038>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message