diff --git a/src/test/java/org/apache/commons/math4/random/JDKRandomAdaptorTest.java b/src/test/java/org/apache/commons/math4/random/JDKRandomAdaptorTest.java index 5ba68c755..7360a887d 100644 --- a/src/test/java/org/apache/commons/math4/random/JDKRandomAdaptorTest.java +++ b/src/test/java/org/apache/commons/math4/random/JDKRandomAdaptorTest.java @@ -80,9 +80,14 @@ public class JDKRandomAdaptorTest { Assert.assertEquals(withoutReseed, withReseed, 0); } - @Test(expected=MathUnsupportedOperationException.class) + @Test public void testSerializeIsNotSupported() { - TestUtils.serializeAndRecover(new JDKRandomAdaptor(RandomSource.create(RandomSource.WELL_512_A))); + try { + TestUtils.serializeAndRecover(new JDKRandomAdaptor(RandomSource.create(RandomSource.WELL_512_A))); + } catch (Exception e) { + Throwable cause = e.getCause(); + Assert.assertTrue(cause instanceof MathUnsupportedOperationException); + } } /**