justinleet commented on a change in pull request #1554: METRON-2307: Migrate to 
JUnit5
URL: https://github.com/apache/metron/pull/1554#discussion_r346618616
 
 

 ##########
 File path: 
metron-analytics/metron-statistics/src/test/java/org/apache/metron/statistics/OnlineStatisticsProviderTest.java
 ##########
 @@ -96,19 +98,22 @@ private void validateEquality(Iterable<Double> values) {
     validateStatisticsProvider(aggregatedProvider, summaryStats, stats);
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testOverflow() {
     OnlineStatisticsProvider statsProvider = new OnlineStatisticsProvider();
-    statsProvider.addValue(Double.MAX_VALUE + 1);
+    assertThrows(IllegalStateException.class, () -> 
statsProvider.addValue(Double.MAX_VALUE + 1));
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testUnderflow() {
     OnlineStatisticsProvider statsProvider = new OnlineStatisticsProvider();
     double d = 3e-305;
-    for(int i = 0;i < 5;++i,d/=100000) {
-      statsProvider.addValue(d);
-    }
+//    for(int i = 0;i < 5;++i,d/=100000) {
+    assertThrows(IllegalStateException.class, () -> statsProvider.addValue(d));
+//    }
+//    for(int i = 0;i < 5;++i,d/=100000) {
 
 Review comment:
   ahh, I left that in, and forgot about it. That test actually throws on the 
first iteration of the loop anyway. I remember being surprised about it, 
because I wasn't really looking forward to figuring out how to fix it properly.
   
   Dropped it, and fixed the error message in the original class (it actually 
says it's double overflow instead of underflow)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to