You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2023/02/16 14:46:26 UTC

[commons-statistics] 03/05: Use action for the test assertion

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-statistics.git

commit 948908cd6b8c6d66852324f37588cee51d5c7148
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Feb 16 13:49:47 2023 +0000

    Use action for the test assertion
---
 .../statistics/inference/FisherExactTestTest.java   | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/commons-statistics-inference/src/test/java/org/apache/commons/statistics/inference/FisherExactTestTest.java b/commons-statistics-inference/src/test/java/org/apache/commons/statistics/inference/FisherExactTestTest.java
index 9b157ff..a20cbdf 100644
--- a/commons-statistics-inference/src/test/java/org/apache/commons/statistics/inference/FisherExactTestTest.java
+++ b/commons-statistics-inference/src/test/java/org/apache/commons/statistics/inference/FisherExactTestTest.java
@@ -48,21 +48,14 @@ class FisherExactTestTest {
 
     private void assertFisherExactTestInvalidTableThrows(Consumer<int[][]> action) {
         // Non 2-by-2 input
-        Assertions.assertThrows(IllegalArgumentException.class, () ->
-            FisherExactTest.withDefaults().test(new int[3][3]));
-        Assertions.assertThrows(IllegalArgumentException.class, () ->
-            FisherExactTest.withDefaults().test(new int[2][1]));
-        Assertions.assertThrows(IllegalArgumentException.class, () ->
-            FisherExactTest.withDefaults().test(new int[1][2]));
+        Assertions.assertThrows(IllegalArgumentException.class, () -> action.accept(new int[3][3]));
+        Assertions.assertThrows(IllegalArgumentException.class, () -> action.accept(new int[2][1]));
+        Assertions.assertThrows(IllegalArgumentException.class, () -> action.accept(new int[1][2]));
         // Non-square input
-        Assertions.assertThrows(IllegalArgumentException.class, () ->
-            FisherExactTest.withDefaults().test(new int[][] {
-                new int[2], new int[1]
-            }));
-        Assertions.assertThrows(IllegalArgumentException.class, () ->
-            FisherExactTest.withDefaults().test(new int[][] {
-                new int[1], new int[2]
-            }));
+        final int[][] x = {{1, 2}, {3}};
+        Assertions.assertThrows(IllegalArgumentException.class, () -> action.accept(x));
+        final int[][] y = {{1}, {2, 3}};
+        Assertions.assertThrows(IllegalArgumentException.class, () -> action.accept(y));
     }
 
     @ParameterizedTest