jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] 08/08: Convert to assertThrows
Date Sat, 10 Apr 2021 10:03:44 GMT
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 beb5e69165b9c3e83ec1d9c78a828c86f836e15d
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Sat Apr 10 11:38:32 2021 +0200

    Convert to assertThrows
    
    Closes #652
---
 .../test/java/org/apache/jmeter/junit/JMeterTestCaseJUnit.java   | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/core/src/test/java/org/apache/jmeter/junit/JMeterTestCaseJUnit.java b/src/core/src/test/java/org/apache/jmeter/junit/JMeterTestCaseJUnit.java
index 27c5074..41b2f14 100644
--- a/src/core/src/test/java/org/apache/jmeter/junit/JMeterTestCaseJUnit.java
+++ b/src/core/src/test/java/org/apache/jmeter/junit/JMeterTestCaseJUnit.java
@@ -17,6 +17,8 @@
 
 package org.apache.jmeter.junit;
 
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
 import java.io.File;
 import java.nio.charset.Charset;
 import java.util.Collection;
@@ -110,12 +112,7 @@ public abstract class JMeterTestCaseJUnit extends TestCase {
             throws Exception {
         Collection<CompoundVariable> parms = new LinkedList<>();
         for (int c = 0; c < minimum; c++) {
-            try {
-                func.setParameters(parms);
-                fail("Should have generated InvalidVariableException for " + parms.size()
-                        + " parameters");
-            } catch (InvalidVariableException ignored) {
-            }
+            assertThrows(InvalidVariableException.class, () -> func.setParameters(parms));
             parms.add(new CompoundVariable());
         }
         func.setParameters(parms);

Mime
View raw message