jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] 01/08: Changing exception handling from try/catch to API recommendation
Date Sat, 10 Apr 2021 10:03:37 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 939211e32caa77f8307b0462f31ee0810c3b65a9
Author: Elvys Soares <eas5@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 <eas5@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) {
-        }
+        });
     }
 }

Mime
View raw message