jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1859462 - /jmeter/trunk/test/src/org/apache/jmeter/config/TestRandomVariableConfig.java
Date Sat, 18 May 2019 10:32:42 GMT
Author: fschumacher
Date: Sat May 18 10:32:42 2019
New Revision: 1859462

URL: http://svn.apache.org/viewvc?rev=1859462&view=rev
Log:
Use constant for repeatedly used var name

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/config/TestRandomVariableConfig.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/config/TestRandomVariableConfig.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/config/TestRandomVariableConfig.java?rev=1859462&r1=1859461&r2=1859462&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/config/TestRandomVariableConfig.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/config/TestRandomVariableConfig.java Sat May 18
10:32:42 2019
@@ -35,6 +35,8 @@ import org.junit.Test;
 
 public class TestRandomVariableConfig extends JMeterTestCase {
 
+    private static final String RANDOM_VAR_NAME = "randomVar";
+
     private JMeterVariables threadVars;
     
     private static final String MIN_VALUE = "0";
@@ -47,7 +49,7 @@ public class TestRandomVariableConfig ex
         jmcx.setVariables(new JMeterVariables());
         threadVars = jmcx.getVariables();        
         config.setRandomSeed("abcd");
-        config.setVariableName("randomVar");
+        config.setVariableName(RANDOM_VAR_NAME);
 
     }
 
@@ -61,8 +63,8 @@ public class TestRandomVariableConfig ex
         config.setMaximumValue(MAX_VALUE);
         for (int i = 0; i < 100;i++) {
             config.iterationStart(null);
-            String value = threadVars.get("randomVar");
-            Assert.assertNotNull(threadVars.get("randomVar"));
+            String value = threadVars.get(RANDOM_VAR_NAME);
+            Assert.assertNotNull(threadVars.get(RANDOM_VAR_NAME));
             int numericValue = Integer.parseInt(value);
             Assert.assertTrue("value:"+numericValue+" is not in range ["+MIN_VALUE+","+MAX_VALUE+"]",

                     numericValue >=0 && numericValue <=10);            
@@ -75,8 +77,8 @@ public class TestRandomVariableConfig ex
         config.setMaximumValue(MAX_VALUE);
         config.setOutputFormat("000.00");
         config.iterationStart(null);
-        String value = threadVars.get("randomVar");
-        Assert.assertNotNull(threadVars.get("randomVar"));
+        String value = threadVars.get(RANDOM_VAR_NAME);
+        Assert.assertNotNull(threadVars.get(RANDOM_VAR_NAME));
         Assert.assertEquals("010.00", value);
 
     }
@@ -86,7 +88,7 @@ public class TestRandomVariableConfig ex
         config.setMinimumValue(MAX_VALUE);
         config.setMaximumValue(MIN_VALUE);
         config.iterationStart(null);
-        Assert.assertNull(threadVars.get("randomVar"));
+        Assert.assertNull(threadVars.get(RANDOM_VAR_NAME));
     }
 
 }



Mime
View raw message