jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1728219 - in /jmeter/trunk/test/src/org/apache/jmeter: report/core/ report/processor/ samplers/ save/ services/ testbeans/gui/ testelement/ testelement/property/ threads/
Date Tue, 02 Feb 2016 21:30:46 GMT
Author: pmouawad
Date: Tue Feb  2 21:30:46 2016
New Revision: 1728219

URL: http://svn.apache.org/viewvc?rev=1728219&view=rev
Log:
Bug 58897 - Improve JUnit Test code STEP 4
Part 2 patch by B. Wiart
Bugzilla Id: 58897

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataTest.java
    jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java
    jmeter/trunk/test/src/org/apache/jmeter/report/processor/FieldSampleComparatorTest.java
    jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java
    jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java
    jmeter/trunk/test/src/org/apache/jmeter/save/TestCSVSaveService.java
    jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java
    jmeter/trunk/test/src/org/apache/jmeter/services/TestFileServer.java
    jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/PackageTest.java
    jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestBooleanPropertyEditor.java
    jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestComboStringEditor.java
    jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestFieldStringEditor.java
    jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java
    jmeter/trunk/test/src/org/apache/jmeter/testelement/property/PackageTest.java
    jmeter/trunk/test/src/org/apache/jmeter/threads/TestJMeterContextService.java
    jmeter/trunk/test/src/org/apache/jmeter/threads/TestTestCompiler.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataTest.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataTest.java Tue Feb  2
21:30:46 2016
@@ -17,10 +17,13 @@
  */
 package org.apache.jmeter.report.core;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
 
-public class SampleMetadataTest extends TestCase {
+import org.junit.Test;
 
+public class SampleMetadataTest {
+
+    @Test
     public void testToString() {
         assertEquals("a,b", new SampleMetadata(',', "a", "b").toString());
     }

Modified: jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/report/core/TestCsvSampleWriter.java Tue Feb 
2 21:30:46 2016
@@ -17,23 +17,26 @@
  */
 package org.apache.jmeter.report.core;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import java.io.StringWriter;
 import java.io.Writer;
-
-import junit.framework.TestCase;
-
 import org.apache.jmeter.util.JMeterUtils;
+import org.junit.Before;
+import org.junit.Test;
 
-public class TestCsvSampleWriter extends TestCase {
+public class TestCsvSampleWriter {
 
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         // We have to initialize JMeterUtils
         JMeterUtils.loadJMeterProperties("jmeter.properties");
     }
 
     SampleMetadata metadata = new SampleMetadata(',', "a", "b");
 
+    @Test
     public void testCsvSampleWriterConstructorWithNull() throws Exception {
         try {
             CsvSampleWriter dummy = new CsvSampleWriter(null);
@@ -45,6 +48,7 @@ public class TestCsvSampleWriter extends
         }
     }
 
+    @Test
     public void testCsvSampleWriterConstructorWithWriter() throws Exception {
         try (Writer writer = new StringWriter();
                 CsvSampleWriter csvWriter = new CsvSampleWriter(writer,
@@ -55,6 +59,7 @@ public class TestCsvSampleWriter extends
         }
     }
 
+    @Test
     public void testWriteWithoutWriter() throws Exception {
         try (CsvSampleWriter csvWriter = new CsvSampleWriter(metadata)) {
             Sample sample = new SampleBuilder(metadata).add("a1").add("b1")
@@ -68,6 +73,7 @@ public class TestCsvSampleWriter extends
         }
     }
 
+    @Test
     public void testWriteWithoutSample() throws Exception {
         try (Writer writer = new StringWriter();
                 CsvSampleWriter csvWriter = new CsvSampleWriter(writer,
@@ -81,6 +87,7 @@ public class TestCsvSampleWriter extends
         }
     }
 
+    @Test
     public void testWrite() throws Exception {
         try (Writer writer = new StringWriter();
                 CsvSampleWriter csvWriter = new CsvSampleWriter(writer,

Modified: jmeter/trunk/test/src/org/apache/jmeter/report/processor/FieldSampleComparatorTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/report/processor/FieldSampleComparatorTest.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/report/processor/FieldSampleComparatorTest.java
(original)
+++ jmeter/trunk/test/src/org/apache/jmeter/report/processor/FieldSampleComparatorTest.java
Tue Feb  2 21:30:46 2016
@@ -17,20 +17,20 @@
  */
 package org.apache.jmeter.report.processor;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.jmeter.report.core.Sample;
 import org.apache.jmeter.report.core.SampleMetadata;
+import org.junit.Before;
 import org.junit.Test;
 
-public class FieldSampleComparatorTest extends TestCase {
+public class FieldSampleComparatorTest {
 
     private SampleMetadata sampleMetadata;
     private FieldSampleComparator comparator;
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         sampleMetadata = new SampleMetadata(',', "test");
         comparator = new FieldSampleComparator("test");
         comparator.initialize(sampleMetadata);

Modified: jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleResult.java Tue Feb  2 21:30:46
2016
@@ -18,23 +18,25 @@
 
 package org.apache.jmeter.samplers;
 
-import java.io.StringWriter;
-
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
+import java.io.StringWriter;
 import org.apache.jmeter.util.Calculator;
 import org.apache.log.LogTarget;
 import org.apache.log.format.Formatter;
 import org.apache.log.format.RawFormatter;
 import org.apache.log.output.io.WriterTarget;
+import org.junit.Test;
 
 // TODO need more tests - particularly for the new functions
 
-public class TestSampleResult extends TestCase {
-        public TestSampleResult(String name) {
-            super(name);
-        }
+public class TestSampleResult {
 
+        @Test
         public void testElapsedTrue() throws Exception {
             SampleResult res = new SampleResult(true);
 
@@ -48,6 +50,7 @@ public class TestSampleResult extends Te
             }
         }
 
+        @Test
         public void testElapsedFalse() throws Exception {
             SampleResult res = new SampleResult(false);
 
@@ -61,6 +64,7 @@ public class TestSampleResult extends Te
             }
         }
 
+        @Test
         public void testPauseFalse() throws Exception {
             SampleResult res = new SampleResult(false);
             // Check sample increments OK
@@ -80,6 +84,7 @@ public class TestSampleResult extends Te
             }
         }
 
+        @Test
         public void testPauseTrue() throws Exception {
             SampleResult res = new SampleResult(true);
             // Check sample increments OK
@@ -109,6 +114,7 @@ public class TestSampleResult extends Te
             SampleResult.log.setLogTargets(lt);
         }
 
+        @Test
         public void testPause2True() throws Exception {
             divertLog();
             SampleResult res = new SampleResult(true);
@@ -119,6 +125,7 @@ public class TestSampleResult extends Te
             assertFalse(wr.toString().length() == 0);
         }
 
+        @Test
         public void testPause2False() throws Exception {
             divertLog();
             SampleResult res = new SampleResult(false);
@@ -129,6 +136,7 @@ public class TestSampleResult extends Te
             assertFalse(wr.toString().length() == 0);
         }
         
+        @Test
         public void testByteCount() throws Exception {
             SampleResult res = new SampleResult();
             
@@ -140,34 +148,42 @@ public class TestSampleResult extends Te
             assertEquals("sample of size 100 bytes", res.getSampleLabel());
         }
 
+        @Test
         public void testSubResultsTrue() throws Exception {
             testSubResults(true, 0);
         }
 
+        @Test
         public void testSubResultsTrueThread() throws Exception {
             testSubResults(true, 500L, 0);
         }
 
+        @Test
         public void testSubResultsFalse() throws Exception {
             testSubResults(false, 0);
         }
 
+        @Test
         public void testSubResultsFalseThread() throws Exception {
             testSubResults(false, 500L, 0);
         }
 
+        @Test
         public void testSubResultsTruePause() throws Exception {
             testSubResults(true, 100);
         }
 
+        @Test
         public void testSubResultsTruePauseThread() throws Exception {
             testSubResults(true, 500L, 100);
         }
 
+        @Test
         public void testSubResultsFalsePause() throws Exception {
             testSubResults(false, 100);
         }
 
+        @Test
         public void testSubResultsFalsePauseThread() throws Exception {
             testSubResults(false, 500L, 100);
         }
@@ -293,6 +309,7 @@ public class TestSampleResult extends Te
 
         // TODO some more invalid sequence tests needed
         
+        @Test
         public void testEncodingAndType() throws Exception {
             // check default
             SampleResult res = new SampleResult();

Modified: jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java Tue
Feb  2 21:30:46 2016
@@ -18,16 +18,21 @@
 
 package org.apache.jmeter.samplers;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+
 import java.text.SimpleDateFormat;
 
 import org.apache.jmeter.junit.JMeterTestCase;
+import org.junit.Test;
 
 // Extends JMeterTest case because it needs access to JMeter properties
 public class TestSampleSaveConfiguration extends JMeterTestCase {    
-    public TestSampleSaveConfiguration(String name) {
-        super(name);
-    }
 
+    @Test
     public void testClone() throws Exception {
         SampleSaveConfiguration a = new SampleSaveConfiguration();
         a.setUrl(false);
@@ -62,6 +67,7 @@ public class TestSampleSaveConfiguration
         assertEquals(a.hashCode(), cloneA.hashCode());        
     }
     
+    @Test
     public void testEqualsAndHashCode() throws Exception {
         SampleSaveConfiguration a = new SampleSaveConfiguration();
         a.setUrl(false);
@@ -94,6 +100,7 @@ public class TestSampleSaveConfiguration
         assertFalse(a.saveAssertions() == b.saveAssertions());
     }
 
+    @Test
     public void testFalse() throws Exception {
         SampleSaveConfiguration a = new SampleSaveConfiguration(false);
         SampleSaveConfiguration b = new SampleSaveConfiguration(false);
@@ -102,6 +109,7 @@ public class TestSampleSaveConfiguration
         assertTrue("Objects should be equal",b.equals(a));
     }
 
+    @Test
     public void testTrue() throws Exception {
         SampleSaveConfiguration a = new SampleSaveConfiguration(true);
         SampleSaveConfiguration b = new SampleSaveConfiguration(true);
@@ -109,6 +117,7 @@ public class TestSampleSaveConfiguration
         assertTrue("Objects should be equal",a.equals(b));
         assertTrue("Objects should be equal",b.equals(a));
     }
+    @Test
     public void testFalseTrue() throws Exception {
         SampleSaveConfiguration a = new SampleSaveConfiguration(false);
         SampleSaveConfiguration b = new SampleSaveConfiguration(true);
@@ -117,6 +126,7 @@ public class TestSampleSaveConfiguration
         assertFalse("Objects should not be equal",b.equals(a));
     }
 
+    @Test
     public void testFormatter() throws Exception {
         SampleSaveConfiguration a = new SampleSaveConfiguration(false);
         SampleSaveConfiguration b = new SampleSaveConfiguration(false);

Modified: jmeter/trunk/test/src/org/apache/jmeter/save/TestCSVSaveService.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/save/TestCSVSaveService.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/save/TestCSVSaveService.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/save/TestCSVSaveService.java Tue Feb  2 21:30:46
2016
@@ -18,18 +18,18 @@
 
 package org.apache.jmeter.save;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
 
 import org.apache.jmeter.junit.JMeterTestCase;
+import org.junit.Test;
 
 public class TestCSVSaveService extends JMeterTestCase {
 
-    public TestCSVSaveService(String name) {
-        super(name);
-    }
-    
     private void checkSplitString(String input, char delim, String[] expected) throws Exception
{
         String out[] = CSVSaveService.csvSplitString(input, delim);     
         checkStrings(expected, out);
@@ -43,12 +43,14 @@ public class TestCSVSaveService extends
     }
     
     // This is what JOrphanUtils.split() does
+    @Test
     public void testSplitEmpty() throws Exception {
         checkSplitString("",         ',', new String[]{});    
     }
     
     // These tests should agree with those for JOrphanUtils.split() as far as possible
     
+    @Test
     public void testSplitUnquoted() throws Exception {
         checkSplitString("a",         ',', new String[]{"a"});
         checkSplitString("a,bc,d,e", ',', new String[]{"a","bc","d","e"});
@@ -66,6 +68,7 @@ public class TestCSVSaveService extends
         checkSplitString("a,b\u00e7,d,\u00e9", ',', new String[]{"a","b\u00e7","d","\u00e9"});

     }
 
+    @Test
     public void testSplitQuoted() throws Exception {
         checkSplitString("a,bc,d,e",     ',', new String[]{"a","bc","d","e"});
         checkSplitString(",bc,d,e",      ',', new String[]{"","bc","d","e"});
@@ -85,6 +88,7 @@ public class TestCSVSaveService extends
         checkSplitString("\"a\",\"b\u00e7\",\"d\",\"\u00e9\"", ',', new String[]{"a","b\u00e7","d","\u00e9"});

     }
 
+    @Test
     public void testSplitBadQuote() throws Exception {
         try {
             checkSplitString("a\"b",',',new String[]{});
@@ -93,6 +97,7 @@ public class TestCSVSaveService extends
         }
     }
     
+    @Test
     public void testSplitMultiLine() throws Exception  {
         String line="a,,\"c\nd\",e\n,,f,g,\n\n";
         String[] out;
@@ -111,6 +116,7 @@ public class TestCSVSaveService extends
         checkStrings(new String[]{}, out);
     }
 
+    @Test
     public void testBlankLine() throws Exception  {
         BufferedReader br = new BufferedReader(new StringReader("\n"));
         String[] out = CSVSaveService.csvReadFile(br, ',');
@@ -118,6 +124,7 @@ public class TestCSVSaveService extends
         assertEquals("Expected to be at EOF",-1,br.read());
     }
 
+    @Test
     public void testBlankLineQuoted() throws Exception  {
         BufferedReader br = new BufferedReader(new StringReader("\"\"\n"));
         String[] out = CSVSaveService.csvReadFile(br, ',');
@@ -125,6 +132,7 @@ public class TestCSVSaveService extends
         assertEquals("Expected to be at EOF",-1,br.read());
     }
 
+    @Test
     public void testEmptyFile() throws Exception  {
         BufferedReader br = new BufferedReader(new StringReader(""));
         String[] out = CSVSaveService.csvReadFile(br, ',');
@@ -132,6 +140,7 @@ public class TestCSVSaveService extends
         assertEquals("Expected to be at EOF",-1,br.read());
     }
 
+    @Test
     public void testShortFile() throws Exception  {
         BufferedReader br = new BufferedReader(new StringReader("a"));
         String[] out = CSVSaveService.csvReadFile(br, ',');

Modified: jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/save/TestSaveService.java Tue Feb  2 21:30:46
2016
@@ -18,6 +18,11 @@
 
 package org.apache.jmeter.save;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -30,6 +35,7 @@ import java.util.List;
 import org.apache.jmeter.junit.JMeterTestCase;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.collections.HashTree;
+import org.junit.Test;
 
 public class TestSaveService extends JMeterTestCase {
     
@@ -71,22 +77,23 @@ public class TestSaveService extends JMe
 
     private static final boolean saveOut = JMeterUtils.getPropDefault("testsaveservice.saveout",
false);
 
-    public TestSaveService(String name) {
-        super(name);
-    }
 
+    @Test
     public void testPropfile1() throws Exception {
         assertEquals("Property Version mismatch, ensure you update SaveService#PROPVERSION
field with _version property value from saveservice.properties", SaveService.PROPVERSION,
SaveService.getPropertyVersion());            
     }
 
+    @Test
     public void testPropfile2() throws Exception {
         assertEquals("Property File Version mismatch, ensure you update SaveService#FILEVERSION
field with revision id of saveservice.properties", SaveService.FILEVERSION, SaveService.getFileVersion());
     }
     
+    @Test
     public void testVersions() throws Exception {
         assertTrue("Unexpected version found", SaveService.checkVersions());
     }
 
+    @Test
     public void testLoadAndSave() throws Exception {
         boolean failed = false; // Did a test fail?
 
@@ -182,6 +189,7 @@ public class TestSaveService extends JMe
         }
     }
 
+    @Test
     public void testLoad() throws Exception {
         for (int i = 0; i < FILES_LOAD_ONLY.length; i++) {
             File file = findTestFile("testfiles/" + FILES_LOAD_ONLY[i]);
@@ -196,6 +204,7 @@ public class TestSaveService extends JMe
 
     }
 
+    @Test
     public void testClasses(){
         List<String> missingClasses = SaveService.checkClasses();
         if(missingClasses.size()>0) {

Modified: jmeter/trunk/test/src/org/apache/jmeter/services/TestFileServer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/services/TestFileServer.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/services/TestFileServer.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/services/TestFileServer.java Tue Feb  2 21:30:46
2016
@@ -22,33 +22,36 @@
      
 package org.apache.jmeter.services;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.File;
 import java.io.IOException;
 
 import org.apache.jmeter.junit.JMeterTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 public class TestFileServer extends JMeterTestCase {
 
     private static final FileServer FS = FileServer.getFileServer();
     
-    public TestFileServer() {
-        super();
-    }
-
-    public TestFileServer(String arg0) {
-        super(arg0);
-    }
 
-    @Override
+    @Before
     public void setUp() throws IOException {
         FS.resetBase();        
     }
 
-    @Override
+    @After
     public void tearDown() throws IOException{
         FS.closeFiles();
     }
     
+    @Test
     public void testopen() throws Exception {
         try {
             FS.readLine("test");
@@ -103,6 +106,7 @@ public class TestFileServer extends JMet
         FS.closeFiles();
     }
     
+    @Test
     public void testRelative() throws Exception {
         final String base = FileServer.getDefaultBase();
         final File basefile = new File(base);
@@ -117,6 +121,7 @@ public class TestFileServer extends JMet
         assertEquals("abcd",FS.getBaseDirRelative().toString());
     }
 
+    @Test
     public void testHeaderMissingFile() throws Exception {
         final String missing = "no-such-file";
         final String alias = "missing";
@@ -137,6 +142,7 @@ public class TestFileServer extends JMet
         }
     }
 
+    @Test
     public void testHeaderEmptyFile() throws Exception {
         final String empty = findTestPath("testfiles/empty.csv");
         final String alias = "empty";
@@ -157,6 +163,7 @@ public class TestFileServer extends JMet
         }
     }
 
+    @Test
     public void testResolvingPaths() {
         final File anchor = new File(findTestPath("testfiles/empty.csv"));
 

Modified: jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/PackageTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/PackageTest.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/PackageTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/PackageTest.java Tue Feb  2 21:30:46
2016
@@ -26,7 +26,7 @@ import java.util.Locale;
 import java.util.ResourceBundle;
 
 import org.apache.jmeter.gui.util.JMeterMenuBar;
-import org.apache.jmeter.junit.JMeterTestCase;
+import org.apache.jmeter.junit.JMeterTestCaseJUnit3;
 import org.apache.jmeter.testbeans.TestBean;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
@@ -47,7 +47,7 @@ import junit.framework.TestSuite;
  * TODO: - Check property files don't have duplicate keys (is this important)
  * 
  */
-public final class PackageTest extends JMeterTestCase {
+public final class PackageTest extends JMeterTestCaseJUnit3 {
     private static final Logger log = LoggingManager.getLoggerForClass();
 
     // ResourceBundle i18nEdit=

Modified: jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestBooleanPropertyEditor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestBooleanPropertyEditor.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestBooleanPropertyEditor.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestBooleanPropertyEditor.java Tue
Feb  2 21:30:46 2016
@@ -16,8 +16,12 @@
  */
 package org.apache.jmeter.testbeans.gui;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.beans.PropertyEditor;
 import java.beans.PropertyEditorManager;
+import org.junit.Test;
 
 /**
  * Test class to check that the JVM provides sensible behaviour for the boolean PropertyEditor,
i.e.
@@ -36,15 +40,14 @@ public class TestBooleanPropertyEditor e
     private static final String FALSE = "False"; // $NON-NLS-1$
     private static final String TRUE  = "True";  // $NON-NLS-1$
 
-    public TestBooleanPropertyEditor(String name) {
-        super(name);
-    }
 
+    @Test
     public void testBooleanEditor(){
         PropertyEditor propertyEditor = PropertyEditorManager.findEditor(boolean.class);
         testBooleanEditor(propertyEditor);
     }
 
+    @Test
     public void testBooleanPropertyEditor() {
         PropertyEditor propertyEditor = new BooleanPropertyEditor();
         testBooleanEditor(propertyEditor);

Modified: jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestComboStringEditor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestComboStringEditor.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestComboStringEditor.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestComboStringEditor.java Tue Feb
 2 21:30:46 2016
@@ -16,10 +16,12 @@
  */
 package org.apache.jmeter.testbeans.gui;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
 public class TestComboStringEditor extends junit.framework.TestCase {
-        public TestComboStringEditor(String name) {
-            super(name);
-        }
 
         private void testSetGet(ComboStringEditor e, Object value) throws Exception {
             e.setValue(value);
@@ -31,6 +33,7 @@ public class TestComboStringEditor exten
             assertEquals(text, e.getAsText());
         }
 
+        @Test
         public void testSetGet() throws Exception {
             @SuppressWarnings("deprecation") // test code, intentional
             ComboStringEditor e = new ComboStringEditor();
@@ -41,6 +44,7 @@ public class TestComboStringEditor exten
             testSetGet(e, "${var}");
         }
 
+        @Test
         public void testSetGetAsText() throws Exception {
             @SuppressWarnings("deprecation") // test code, intentional
             ComboStringEditor e = new ComboStringEditor();

Modified: jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestFieldStringEditor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestFieldStringEditor.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestFieldStringEditor.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/testbeans/gui/TestFieldStringEditor.java Tue Feb
 2 21:30:46 2016
@@ -16,11 +16,11 @@
  */
 package org.apache.jmeter.testbeans.gui;
 
+import static org.junit.Assert.assertEquals;
 
-public class TestFieldStringEditor extends junit.framework.TestCase {
-        public TestFieldStringEditor(String name) {
-            super(name);
-        }
+import org.junit.Test;
+
+public class TestFieldStringEditor {
 
         private void testSetGet(ComboStringEditor e, Object value) throws Exception {
             e.setValue(value);
@@ -32,6 +32,7 @@ public class TestFieldStringEditor exten
             assertEquals(text, e.getAsText());
         }
 
+        @Test
         public void testSetGet() throws Exception {
             @SuppressWarnings("deprecation") // test code, intentional
             ComboStringEditor e = new ComboStringEditor();
@@ -41,6 +42,7 @@ public class TestFieldStringEditor exten
             testSetGet(e, "${var}");
         }
 
+        @Test
         public void testSetGetAsText() throws Exception {
             @SuppressWarnings("deprecation") // test code, intentional
             ComboStringEditor e = new ComboStringEditor();

Modified: jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/testelement/PackageTest.java Tue Feb  2 21:30:46
2016
@@ -22,7 +22,9 @@
  */
 package org.apache.jmeter.testelement;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.jmeter.config.Arguments;
 import org.apache.jmeter.config.ConfigTestElement;
@@ -34,11 +36,9 @@ import org.apache.jmeter.testelement.pro
 import org.apache.jmeter.testelement.property.NullProperty;
 import org.apache.jmeter.testelement.property.StringProperty;
 import org.apache.jmeter.testelement.property.TestElementProperty;
+import org.junit.Test;
 
-public class PackageTest extends TestCase {
-    public PackageTest(String arg0) {
-        super(arg0);
-    }
+public class PackageTest {
 
     // Test needs to run in this package in order to give access to AbstractTestElement.addProperty()

     public void DISABLEDtestBug50799() throws Exception {
@@ -70,6 +70,7 @@ public class PackageTest extends TestCas
         assertEquals(new Header("2ndLevelTestHeader", "testValue2"), headerManager2.get(0));
     }
 
+    @Test
     public void testRecovery() throws Exception {
         ConfigTestElement config = new ConfigTestElement();
         config.addProperty(new StringProperty("name", "config"));
@@ -87,6 +88,7 @@ public class PackageTest extends TestCas
         assertEquals(new NullProperty("login"), config.getProperty("login"));
     }
 
+    @Test
     public void testArguments() throws Exception {
         Arguments args = new Arguments();
         args.addArgument("arg1", "val1", "=");

Modified: jmeter/trunk/test/src/org/apache/jmeter/testelement/property/PackageTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/testelement/property/PackageTest.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/testelement/property/PackageTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/testelement/property/PackageTest.java Tue Feb
 2 21:30:46 2016
@@ -18,19 +18,20 @@
 
 package org.apache.jmeter.testelement.property;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
 
 import org.apache.jmeter.config.LoginConfig;
+import org.junit.Test;
 
 /**
  * Class for testing the property package.
  */
-public class PackageTest extends TestCase {
+public class PackageTest {
 
-    public PackageTest(String name) {
-        super(name);
-    }
 
+    @Test
     public void testStringProperty() throws Exception {
         StringProperty prop = new StringProperty("name", "value");
         prop.setRunningVersion(true);
@@ -45,6 +46,7 @@ public class PackageTest extends TestCas
         assertEquals("value", prop.getStringValue());
     }
 
+    @Test
     public void testElementProperty() throws Exception {
         LoginConfig config = new LoginConfig();
         config.setUsername("username");
@@ -88,6 +90,7 @@ public class PackageTest extends TestCas
         // do not check hashcodes; unequal objects may have equal hashcodes
     }
 
+    @Test
     public void testBooleanEquality() throws Exception {
         BooleanProperty jpn1 = new BooleanProperty();
         BooleanProperty jpn2 = new BooleanProperty();
@@ -104,6 +107,7 @@ public class PackageTest extends TestCas
         checkNotEquals(jp3, jp4);
     }
 
+    @Test
     public void testDoubleEquality() throws Exception {
         DoubleProperty jpn1 = new DoubleProperty();
         DoubleProperty jpn2 = new DoubleProperty();
@@ -145,6 +149,7 @@ public class PackageTest extends TestCas
         checkEquals(jp16, jp17);
     }
 
+    @Test
     public void testFloatEquality() throws Exception {
         FloatProperty jp1 = new FloatProperty("name1", 123.4f);
         FloatProperty jp2 = new FloatProperty("name1", 123.4f);
@@ -181,6 +186,7 @@ public class PackageTest extends TestCas
         checkEquals(jp16, jp17);
     }
 
+    @Test
     public void testIntegerEquality() throws Exception {
         IntegerProperty jp1 = new IntegerProperty("name1", 123);
         IntegerProperty jp2 = new IntegerProperty("name1", 123);
@@ -215,6 +221,7 @@ public class PackageTest extends TestCas
         }
     }
 
+    @Test
     public void testLongEquality() throws Exception {
         LongProperty jp1 = new LongProperty("name1", 123);
         LongProperty jp2 = new LongProperty("name1", 123);
@@ -244,6 +251,7 @@ public class PackageTest extends TestCas
         }
     }
 
+    @Test
     public void testMapEquality() throws Exception {
         try {
             new MapProperty(null, null);
@@ -253,6 +261,7 @@ public class PackageTest extends TestCas
 
     }
 
+    @Test
     public void testNullEquality() throws Exception {
         NullProperty jpn1 = new NullProperty();
         NullProperty jpn2 = new NullProperty();
@@ -273,6 +282,7 @@ public class PackageTest extends TestCas
         checkEquals(jp3, jp4);
     }
 
+    @Test
     public void testStringEquality() throws Exception {
         StringProperty jpn1 = new StringProperty();
         StringProperty jpn2 = new StringProperty();
@@ -304,6 +314,7 @@ public class PackageTest extends TestCas
         }
 
     }
+    @Test
     public void testAddingProperties() throws Exception {
         CollectionProperty coll = new CollectionProperty();
         coll.addItem("joe");

Modified: jmeter/trunk/test/src/org/apache/jmeter/threads/TestJMeterContextService.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/threads/TestJMeterContextService.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/threads/TestJMeterContextService.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/threads/TestJMeterContextService.java Tue Feb
 2 21:30:46 2016
@@ -18,14 +18,13 @@
 
 package org.apache.jmeter.threads;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
 
-public class TestJMeterContextService extends TestCase {
+import org.junit.Test;
 
-    public TestJMeterContextService(String name) {
-        super(name);
-    }
+public class TestJMeterContextService {
 
+    @Test
     public void testCounts(){
         assertEquals(0,JMeterContextService.getNumberOfThreads());
         assertEquals(0,JMeterContextService.getTotalThreads());

Modified: jmeter/trunk/test/src/org/apache/jmeter/threads/TestTestCompiler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/threads/TestTestCompiler.java?rev=1728219&r1=1728218&r2=1728219&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/threads/TestTestCompiler.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/threads/TestTestCompiler.java Tue Feb  2 21:30:46
2016
@@ -18,17 +18,18 @@
 
 package org.apache.jmeter.threads;
 
+import static org.junit.Assert.assertEquals;
+
 import org.apache.jmeter.config.ConfigTestElement;
 import org.apache.jmeter.control.GenericController;
 import org.apache.jmeter.samplers.AbstractSampler;
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jorphan.collections.ListedHashTree;
+import org.junit.Test;
 
-public class TestTestCompiler extends junit.framework.TestCase {
-        public TestTestCompiler(String name) {
-            super(name);
-        }
+public class TestTestCompiler {
 
+        @Test
         public void testConfigGathering() throws Exception {
             ListedHashTree testing = new ListedHashTree();
             GenericController controller = new GenericController();




Mime
View raw message