You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2021/04/10 10:03:43 UTC

[jmeter] 07/08: Convert to assertThrows

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

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 5df97b8a67fde22c64865d9877507490531d4d5e
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Sat Apr 10 11:34:40 2021 +0200

    Convert to assertThrows
    
    Relates to #652
---
 .../test/java/org/apache/jmeter/functions/TestTimeFunction.java   | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/functions/src/test/java/org/apache/jmeter/functions/TestTimeFunction.java b/src/functions/src/test/java/org/apache/jmeter/functions/TestTimeFunction.java
index 24e1250..397ac72 100644
--- a/src/functions/src/test/java/org/apache/jmeter/functions/TestTimeFunction.java
+++ b/src/functions/src/test/java/org/apache/jmeter/functions/TestTimeFunction.java
@@ -20,7 +20,7 @@ package org.apache.jmeter.functions;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.util.Collection;
 import java.util.LinkedList;
@@ -102,11 +102,7 @@ public class TestTimeFunction extends JMeterTestCase {
         params.add(new CompoundVariable("YMD"));
         params.add(new CompoundVariable("NAME"));
         params.add(new CompoundVariable("YMD"));
-        try {
-            variable.setParameters(params);
-            fail("Should have raised InvalidVariableException");
-        } catch (InvalidVariableException ignored) {
-        }
+        assertThrows(InvalidVariableException.class, () -> variable.setParameters(params));
     }
 
     @Test