jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1768565 - in /jmeter/trunk: src/core/org/apache/jmeter/util/JSR223TestElement.java test/src/org/apache/jmeter/util/JSR223TestElementTest.java
Date Mon, 07 Nov 2016 17:51:59 GMT
Author: fschumacher
Date: Mon Nov  7 17:51:59 2016
New Revision: 1768565

URL: http://svn.apache.org/viewvc?rev=1768565&view=rev
Log:
Followup to r1762110. Fix logic to determine, which language should be chosen.

Bugzilla Id 59945

Added:
    jmeter/trunk/test/src/org/apache/jmeter/util/JSR223TestElementTest.java   (with props)
Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java?rev=1768565&r1=1768564&r2=1768565&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java Mon Nov  7 17:51:59
2016
@@ -104,7 +104,7 @@ public abstract class JSR223TestElement
      */
     private String getScriptLanguageWithDefault() {
         String lang = getScriptLanguage();
-        if (!StringUtils.isNotEmpty(lang)) {
+        if (StringUtils.isNotEmpty(lang)) {
             return lang;
         }
         return DEFAULT_SCRIPT_LANGUAGE;

Added: jmeter/trunk/test/src/org/apache/jmeter/util/JSR223TestElementTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/util/JSR223TestElementTest.java?rev=1768565&view=auto
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/util/JSR223TestElementTest.java (added)
+++ jmeter/trunk/test/src/org/apache/jmeter/util/JSR223TestElementTest.java Mon Nov  7 17:51:59
2016
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.jmeter.util;
+
+import static org.junit.Assert.assertThat;
+
+import org.hamcrest.CoreMatchers;
+import org.junit.Test;
+
+public class JSR223TestElementTest {
+
+    @SuppressWarnings("serial")
+    private JSR223TestElement element = new JSR223TestElement() {
+    };
+
+    @Test
+    public void testGetScriptEngineJS() throws Exception {
+        element.setScriptLanguage("JavaScript");
+        assertThat(element.getScriptEngine().getFactory().getLanguageName(),
+                CoreMatchers.containsString("Script"));
+    }
+
+    @Test
+    public void testGetScriptEngineDefault() throws Exception {
+        element.setScriptLanguage("");
+        assertThat(element.getScriptEngine().getFactory().getLanguageName(),
+                CoreMatchers.is("Groovy"));
+    }
+
+}

Propchange: jmeter/trunk/test/src/org/apache/jmeter/util/JSR223TestElementTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message