You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/10/20 20:33:28 UTC

[GitHub] [commons-math] aherbert commented on a diff in pull request #214: JUnit5 assertThrows TransformUtilsTest

aherbert commented on code in PR #214:
URL: https://github.com/apache/commons-math/pull/214#discussion_r1001086243


##########
commons-math-transform/src/test/java/org/apache/commons/math4/transform/TransformUtilsTest.java:
##########
@@ -22,27 +22,34 @@
 import org.junit.Test;
 
 import org.apache.commons.math3.analysis.function.Sin;
+import org.junit.jupiter.api.function.Executable;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * Tests for {@link TransformUtils}.
  */
 public class TransformUtilsTest {
+
     private static final Sin SIN_FUNCTION = new Sin();
     private static final DoubleUnaryOperator SIN = x -> SIN_FUNCTION.value(x);
 
-    @Test(expected = TransformException.class)
+    @Test
     public void testSampleWrongBounds() {
-        TransformUtils.sample(SIN, Math.PI, 0.0, 10);
+        final Executable testMethod = () -> TransformUtils.sample(SIN, Math.PI, 0.0, 10);

Review Comment:
   I would remove the import of `Executable` and just use the lambda function direct within assertThrows.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org