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 2022/04/18 15:41:53 UTC

[jmeter] 14/16: Suppress diverse warnings in test code

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 bcb2f2261c79a7c0c8e73b901d6f6c7b6f5ff4c7
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Mon Apr 18 17:23:48 2022 +0200

    Suppress diverse warnings in test code
    
    * It might not be nice to catch and print the stack trace, but it
      has been done this way for a long time. (Fix it, if you like)
    * Get rid of unnecessary toString and with it a warning about default
      char encoding
---
 .../org/apache/jmeter/protocol/http/proxy/NonGuiProxySample.java  | 2 +-
 .../jmeter/protocol/mail/sampler/TestMailReaderSampler.java       | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/proxy/NonGuiProxySample.java b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/proxy/NonGuiProxySample.java
index 696e731ae0..3af17cf158 100644
--- a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/proxy/NonGuiProxySample.java
+++ b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/proxy/NonGuiProxySample.java
@@ -78,7 +78,7 @@ public class NonGuiProxySample {
         try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
             SaveService.saveTree(treeModel.getTestPlan(), out);
             out.close();
-            System.out.println(out.toString());
+            System.out.println(out);
         }
 
     }
diff --git a/src/protocol/mail/src/test/java/org/apache/jmeter/protocol/mail/sampler/TestMailReaderSampler.java b/src/protocol/mail/src/test/java/org/apache/jmeter/protocol/mail/sampler/TestMailReaderSampler.java
index 2298d0b058..406d55b998 100644
--- a/src/protocol/mail/src/test/java/org/apache/jmeter/protocol/mail/sampler/TestMailReaderSampler.java
+++ b/src/protocol/mail/src/test/java/org/apache/jmeter/protocol/mail/sampler/TestMailReaderSampler.java
@@ -17,18 +17,18 @@
 
 package org.apache.jmeter.protocol.mail.sampler;
 
-import static org.junit.Assert.assertEquals;
-
 import java.io.File;
 import java.io.IOException;
 import java.util.Locale;
 import java.util.Properties;
 
 import org.apache.jmeter.util.JMeterUtils;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 public class TestMailReaderSampler {
 
+    @SuppressWarnings("CatchAndPrintStackTrace")
     public static void createJMeterEnv() {
         File propsFile;
         try {
@@ -51,7 +51,7 @@ public class TestMailReaderSampler {
         MailReaderSampler sampler = new MailReaderSampler();
         Properties properties = new Properties();
         sampler.addCustomProperties(properties);
-        assertEquals(1, properties.size());
-        assertEquals("mail.prop2.value", properties.getProperty("mail.prop2.name"));
+        Assertions.assertEquals(1, properties.size());
+        Assertions.assertEquals("mail.prop2.value", properties.getProperty("mail.prop2.name"));
     }
 }