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 21:14:07 UTC

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

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


##########
commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/MapRankingTest.java:
##########
@@ -94,15 +97,16 @@ public void testFindClosestNeuron() {
         Assert.assertEquals(3, allBest.size());
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testRankPrecondition() {
         final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create();
         final FeatureInitializer init
             = new OffsetFeatureInitializer(FeatureInitializerFactory.uniform(rng, -0.1, 0.1));
         final FeatureInitializer[] initArray = {init};
 
-        new MapRanking(new NeuronString(3, false, initArray).getNetwork(),
-                       new EuclideanDistance()).rank(new double[] {-1}, 0);
+        assertThrows(IllegalArgumentException.class, () ->

Review Comment:
   Here is an example where the source of the exception is not clear. Can you break this down to create the valid objects first and catch the exception from I presume `MapRanking.rank`.



-- 
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