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:37 UTC
[jmeter] 01/08: Changing exception handling from try/catch to API
recommendation
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 939211e32caa77f8307b0462f31ee0810c3b65a9
Author: Elvys Soares <ea...@cin.ufpe.br>
AuthorDate: Sat Mar 20 17:46:05 2021 -0300
Changing exception handling from try/catch to API recommendation
Signed-off-by: Elvys Soares <ea...@cin.ufpe.br>
---
src/core/src/test/java/org/apache/jorphan/TestXMLBuffer.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/core/src/test/java/org/apache/jorphan/TestXMLBuffer.java b/src/core/src/test/java/org/apache/jorphan/TestXMLBuffer.java
index 0e19677..52bd40d 100644
--- a/src/core/src/test/java/org/apache/jorphan/TestXMLBuffer.java
+++ b/src/core/src/test/java/org/apache/jorphan/TestXMLBuffer.java
@@ -18,7 +18,7 @@
package org.apache.jorphan;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertThrows;
import org.apache.jmeter.junit.JMeterTestCase;
import org.apache.jorphan.util.XMLBuffer;
@@ -50,10 +50,8 @@ public class TestXMLBuffer extends JMeterTestCase {
public void test4() throws Exception{
XMLBuffer xb = new XMLBuffer();
xb.openTag("abc");
- try {
+ assertThrows(IllegalArgumentException.class, () -> {
xb.closeTag("abcd");
- fail("Should have caused IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- }
+ });
}
}