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:40 UTC
[jmeter] 04/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 c95ed11e81d5d19ab5d229d435585af5dfaa9923
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Sat Apr 10 11:12:04 2021 +0200
Convert to assertThrows
Relates to #652
---
.../java/org/apache/jmeter/functions/PackageTest.java | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/src/functions/src/test/java/org/apache/jmeter/functions/PackageTest.java b/src/functions/src/test/java/org/apache/jmeter/functions/PackageTest.java
index acf794b..ae392c9 100644
--- a/src/functions/src/test/java/org/apache/jmeter/functions/PackageTest.java
+++ b/src/functions/src/test/java/org/apache/jmeter/functions/PackageTest.java
@@ -18,6 +18,7 @@
package org.apache.jmeter.functions;
import static org.apache.jmeter.functions.FunctionTestHelper.makeParams;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.FileNotFoundException;
@@ -95,17 +96,9 @@ public class PackageTest extends JMeterTestCaseJUnit {
public void BSH1() throws Exception {
String fn = "src/test/resources/org/apache/jmeter/functions/testfiles/BeanShellTest.bsh";
- try {
- BSHFParams(null, null, null);
- fail("Expected InvalidVariableException");
- } catch (InvalidVariableException e) {
- }
- try {
- BSHFParams("", "", "");
- fail("Expected InvalidVariableException");
- } catch (InvalidVariableException e) {
- }
+ assertThrows(InvalidVariableException.class, () -> BSHFParams(null, null, null));
+ assertThrows(InvalidVariableException.class, () -> BSHFParams("", "", ""));
BeanShell bsh;
try {
@@ -187,11 +180,7 @@ public class PackageTest extends JMeterTestCaseJUnit {
// XPathFileContainer tests
public void XPathtestNull() throws Exception {
- try {
- new XPathFileContainer("nosuch.xml", "/");
- fail("Should not find the file");
- } catch (FileNotFoundException e) {
- }
+ assertThrows(FileNotFoundException.class, () -> new XPathFileContainer("nosuch.xml", "/"));
}
public void XPathtestrowNum() throws Exception {