stokpop commented on a change in pull request #696:
URL: https://github.com/apache/jmeter/pull/696#discussion_r793063619



##########
File path: 
src/core/src/test/java/org/apache/jmeter/gui/util/JSyntaxTextAreaTest.java
##########
@@ -41,7 +45,37 @@ public void testSetLanguage() {
             textArea.setLanguage(null);
             assertEquals(SyntaxConstants.SYNTAX_STYLE_NONE, 
textArea.getSyntaxEditingStyle());
         } catch (HeadlessException he) {
-            // Does not work in headless mode
+            // Does not work in headless mode, which depends on value of 
java.awt.headless property
+            // and the OS (e.g. might work on MacOS and not on Linux due to 
missing X11).
+            System.out.println("WARNING for 
JSyntaxTextAreaTest.testSetLanguage test: does not work in headless mode");
+        }
+    }
+
+    @Test
+    public void testHeadless() {
+        String key = "java.awt.headless";
+        String initialValue = System.getProperty(key);
+        try {
+            System.setProperty(key, "true");
+            // getInstance returns anonymous class with some overridden methods
+            // to avoid errors due to 'java.awt.headless=true'
+            JSyntaxTextArea textArea = JSyntaxTextArea.getInstance(10,20);
+
+            String myText = "my text";
+            textArea.setText(myText);

Review comment:
       agree, I removed the NPE implicit check




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to