jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1728221 - in /jmeter/trunk/test/src/org/apache/jmeter: monitor/model/ protocol/http/config/ protocol/http/control/ protocol/http/control/gui/ protocol/http/modifier/ protocol/http/parser/
Date Tue, 02 Feb 2016 21:39:15 GMT
Author: pmouawad
Date: Tue Feb  2 21:39:15 2016
New Revision: 1728221

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

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/UrlConfigTest.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthManager.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerHC4.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestDNSCacheManager.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/gui/TestHttpTestSampleGui.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHtmlParsingUtils.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/monitor/model/TestObjectFactory.java Tue Feb  2 21:39:15 2016
@@ -16,10 +16,16 @@
  */
 package org.apache.jmeter.monitor.model;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 import java.util.List;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.jmeter.junit.JMeterTestCase;
+import org.junit.Before;
+import org.junit.Test;
 
 public class TestObjectFactory extends JMeterTestCase {
 
@@ -27,28 +33,32 @@ public class TestObjectFactory extends J
     
     private Status status;
 
-    @Override
+    @Before
     public void setUp(){
         of = ObjectFactory.getInstance();
     }
 
 
+    @Test
     public void testStatus() throws Exception {
         status = of.parseString("<status></status>");
         assertNotNull(status);
     }
 
+    @Test
     public void testNoStatus() throws Exception {
         status = of.parseString("<a></a>");
         assertNull(status);
     }
 
+    @Test
     public void testFileData() throws Exception {
         byte[] bytes= FileUtils.readFileToByteArray(findTestFile("testfiles/monitorStatus.xml"));
         status = of.parseBytes(bytes);
         checkResult();
     }
     
+    @Test
     public void testStringData() throws Exception {
         String content = FileUtils.readFileToString(findTestFile("testfiles/monitorStatus.xml"));
         status = of.parseString(content);

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfigTest.java Tue Feb  2 21:39:15 2016
@@ -18,19 +18,18 @@
 
 package org.apache.jmeter.protocol.http.config;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
 
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.config.Arguments;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jmeter.protocol.http.util.HTTPFileArgs;
+import org.junit.Test;
 
-public class MultipartUrlConfigTest extends TestCase {
+public class MultipartUrlConfigTest {
 
-    public MultipartUrlConfigTest(String name) {
-        super(name);
-    }
 
+    @Test
     @SuppressWarnings("deprecation")
     public void testConstructors() {
         MultipartUrlConfig muc = new MultipartUrlConfig();
@@ -43,6 +42,7 @@ public class MultipartUrlConfigTest exte
     }
 
     // TODO - should LF-only EOL be allowed? 
+    @Test
     public void testParseArgumentsLF() {
         String queryString
             = "Content-Disposition: form-data; name=\"aa\"\n"
@@ -91,6 +91,7 @@ public class MultipartUrlConfigTest exte
         assertEquals("xyz  \nxyz  ", arg.getValue());
     }
 
+    @Test
     public void testParseArgumentsCRLF() {
         String queryString
             = "Content-Disposition: form-data; name=\"aa\"\r\n"

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/UrlConfigTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/UrlConfigTest.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/UrlConfigTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/UrlConfigTest.java Tue Feb  2 21:39:15 2016
@@ -18,6 +18,9 @@
 
 package org.apache.jmeter.protocol.http.config;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import org.apache.jmeter.config.Arguments;
 import org.apache.jmeter.junit.JMeterTestCase;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
@@ -26,6 +29,8 @@ import org.apache.jmeter.protocol.http.u
 import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.NullProperty;
 import org.apache.jmeter.testelement.property.TestElementProperty;
+import org.junit.Before;
+import org.junit.Test;
 
 public class UrlConfigTest extends JMeterTestCase {
     private HTTPSamplerBase config;
@@ -34,12 +39,8 @@ public class UrlConfigTest extends JMete
 
     private HTTPSamplerBase partialConfig;
 
-    public UrlConfigTest(String name) {
-        super(name);
-    }
-
-    @Override
-    protected void setUp() {
+    @Before
+    public void setUp() {
         Arguments args = new Arguments();
         args.addArgument("username", "mstover");
         args.addArgument("password", "pass");
@@ -59,11 +60,13 @@ public class UrlConfigTest extends JMete
         partialConfig.setProperty(HTTPSamplerBase.METHOD, HTTPConstants.GET);
     }
 
+    @Test
     public void testSimpleConfig() {
         assertEquals("Full Config", config.getName());
         assertEquals("www.lazer.com", config.getDomain());
     }
 
+    @Test
     public void testOverRide() {
         JMeterProperty jmp = partialConfig.getProperty(HTTPSamplerBase.DOMAIN);
         assertTrue(jmp instanceof NullProperty);

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthManager.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthManager.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestAuthManager.java Tue Feb  2 21:39:15 2016
@@ -18,6 +18,10 @@
 
 package org.apache.jmeter.protocol.http.control;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
@@ -25,20 +29,21 @@ import java.nio.file.Files;
 
 import org.apache.jmeter.junit.JMeterTestCase;
 import org.apache.jmeter.testelement.property.CollectionProperty;
+import org.junit.Test;
 
 public class TestAuthManager extends JMeterTestCase {
-        public TestAuthManager(String name) {
-            super(name);
-        }
 
+        @Test
         public void testHttp() throws Exception {
             assertTrue(AuthManager.isSupportedProtocol(new URL("http:")));
         }
 
+        @Test
         public void testHttps() throws Exception {
             assertTrue(AuthManager.isSupportedProtocol(new URL("https:")));
         }
 
+        @Test
         public void testFile() throws Exception {
             AuthManager am = new AuthManager();
             CollectionProperty ao = am.getAuthObjects();
@@ -81,6 +86,7 @@ public class TestAuthManager extends JMe
             assertEquals("pass", at.getPass());
         }
 
+        @Test
         public void testAddFileWithoutDomainAndRealmWithMechanism() throws IOException {
             File authFile = File.createTempFile("auth", ".txt");
             Files.write(authFile.toPath(), "http://example.com\tuser\tpassword\t\t\tBASIC_DIGEST".getBytes());
@@ -90,6 +96,7 @@ public class TestAuthManager extends JMe
             assertEquals("password", authForURL.getPass());
         }
 
+        @Test
         public void testAddFileWithDomainAndRealmAndDefaultMechanism() throws IOException {
             File authFile = File.createTempFile("auth", ".txt");
             Files.write(authFile.toPath(), "http://example.com\tuser\tpassword\tdomain\tEXAMPLE.COM\tBASIC_DIGEST".getBytes());
@@ -100,6 +107,7 @@ public class TestAuthManager extends JMe
             assertEquals("domain", authForURL.getDomain());
         }
 
+        @Test
         public void testAddFileWithDomainAndRealmAndMechanism() throws IOException {
             File authFile = File.createTempFile("auth", ".txt");
             Files.write(authFile.toPath(), "http://example.com\tuser\tpassword\tdomain\tEXAMPLE.COM\tKERBEROS".getBytes());

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java Tue Feb  2 21:39:15 2016
@@ -18,6 +18,12 @@
 
 package org.apache.jmeter.protocol.http.control;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.io.IOException;
 import java.lang.reflect.Field;
 import java.net.URL;
@@ -41,6 +47,9 @@ import org.apache.jmeter.junit.JMeterTes
 import org.apache.jmeter.protocol.http.control.CacheManager.CacheEntry;
 import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
 import org.apache.jmeter.protocol.http.util.HTTPConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 public class TestCacheManager extends JMeterTestCase {
     
@@ -156,19 +165,14 @@ public class TestCacheManager extends JM
     private HttpURLConnection httpUrlConnection;
     private HTTPSampleResult sampleResultOK;
 
-    public TestCacheManager(String name) {
-        super(name);
-    }
-
     private String makeDate(Date d){
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
         simpleDateFormat.setTimeZone(GMT);
         return simpleDateFormat.format(d);
     }
 
-    @Override
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
         this.cacheManager = new CacheManager();
         this.currentTimeInGMT = makeDate(new Date());
         this.uri = new URI(LOCAL_HOST, false);
@@ -179,8 +183,8 @@ public class TestCacheManager extends JM
         this.sampleResultOK = getSampleResultWithSpecifiedResponseCode("200");
     }
 
-    @Override
-    protected void tearDown() throws Exception {
+    @After
+    public void tearDown() throws Exception {
         this.httpUrlConnection = null;
         this.httpMethod = null;
         this.urlConnection = null;
@@ -189,9 +193,9 @@ public class TestCacheManager extends JM
         this.cacheManager = null;
         this.currentTimeInGMT = null;
         this.sampleResultOK = null;
-        super.tearDown();
     }
 
+    @Test
     public void testExpiresJava() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -207,6 +211,7 @@ public class TestCacheManager extends JM
 
     }
 
+    @Test
     public void testNoExpiresJava() throws Exception{
         this.cacheManager.setUseExpires(false);
         this.cacheManager.testIterationStart(null);
@@ -218,6 +223,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testCacheJava() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -233,6 +239,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
 
+    @Test
     public void testCacheVaryJava() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -247,6 +254,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
 
+    @Test
     public void testExpiresHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -262,6 +270,7 @@ public class TestCacheManager extends JM
     }
     
 
+    @Test
     public void testCacheHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -277,6 +286,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
 
+    @Test
     public void testCacheVaryHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -291,6 +301,7 @@ public class TestCacheManager extends JM
         this.vary = null;
     }
 
+    @Test
     public void testCacheHttpClientHEAD() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -305,6 +316,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testPrivateCacheHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -320,6 +332,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testPrivateCacheNoMaxAgeNoExpireHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -336,6 +349,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testPrivateCacheExpireNoMaxAgeHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -351,6 +365,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
 
+    @Test
     public void testNoCacheHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -362,6 +377,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testNoStoreHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -373,6 +389,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testCacheHttpClientBug51932() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -388,6 +405,7 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
 
+    @Test
     public void testGetClearEachIteration() throws Exception {
         assertFalse("Should default not to clear after each iteration.", this.cacheManager.getClearEachIteration());
         this.cacheManager.setClearEachIteration(true);
@@ -396,11 +414,13 @@ public class TestCacheManager extends JM
         assertFalse("Should be settable not to clear after each iteration.", this.cacheManager.getClearEachIteration());
     }
 
+    @Test
     public void testSaveDetailsWithEmptySampleResultGivesNoCacheEntry() throws Exception {
         saveDetailsWithConnectionAndSampleResultWithResponseCode("");
         assertTrue("Saving details with empty SampleResult should not make cache entry.", getThreadCache().isEmpty());
     }
 
+    @Test
     public void testSaveDetailsURLConnectionWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
         saveDetailsWithConnectionAndSampleResultWithResponseCode("200");
         CacheManager.CacheEntry cacheEntry = getThreadCacheEntry(this.url.toString());
@@ -409,6 +429,7 @@ public class TestCacheManager extends JM
         assertEquals("Saving details with SampleResult & connection with 200 response should make cache entry with last modified date.", this.currentTimeInGMT, cacheEntry.getLastModified());
     }
 
+    @Test
     public void testSaveDetailsHttpMethodWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
         saveDetailsWithHttpMethodAndSampleResultWithResponseCode("200");
         CacheManager.CacheEntry cacheEntry = getThreadCacheEntry(this.httpMethod.getURI().toString());
@@ -417,16 +438,19 @@ public class TestCacheManager extends JM
         assertEquals("Saving details with SampleResult & HttpMethod with 200 response should make cache entry with no last modified date.", this.currentTimeInGMT, cacheEntry.getLastModified());
     }
 
+    @Test
     public void testSaveDetailsURLConnectionWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
         saveDetailsWithConnectionAndSampleResultWithResponseCode("404");
         assertNull("Saving details with SampleResult & connection with 404 response should not make cache entry.", getThreadCacheEntry(url.toString()));
     }
 
+    @Test
     public void testSaveDetailsHttpMethodWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
         saveDetailsWithHttpMethodAndSampleResultWithResponseCode("404");
         assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(this.httpMethod.getPath()));
     }
 
+    @Test
     public void testSetHeadersHttpMethodWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
         this.httpMethod.setURI(this.uri);
         this.httpMethod.addRequestHeader(new Header(HTTPConstants.IF_MODIFIED_SINCE, this.currentTimeInGMT, false));
@@ -437,6 +461,7 @@ public class TestCacheManager extends JM
         checkRequestHeader(HTTPConstants.IF_MODIFIED_SINCE, this.currentTimeInGMT);
     }
 
+    @Test
     public void testSetHeadersHttpMethodWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
         this.httpMethod.setURI(this.uri);
         saveDetailsWithHttpMethodAndSampleResultWithResponseCode("404");
@@ -444,6 +469,7 @@ public class TestCacheManager extends JM
         assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(this.httpMethod.getPath()));
     }
 
+    @Test
     public void testSetHeadersHttpURLConnectionWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
         saveDetailsWithConnectionAndSampleResultWithResponseCode("200");
         setHeadersWithHttpUrlConnectionAndUrl();
@@ -452,12 +478,14 @@ public class TestCacheManager extends JM
         checkProperty(properties, HTTPConstants.IF_MODIFIED_SINCE, this.currentTimeInGMT);
     }
 
+    @Test
     public void testSetHeadersHttpURLConnectionWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
         saveDetailsWithConnectionAndSampleResultWithResponseCode("404");
         setHeadersWithHttpUrlConnectionAndUrl();
         assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(this.url.toString()));
     }
 
+    @Test
     public void testClearCache() throws Exception {
         assertTrue("ThreadCache should be empty initially.", getThreadCache().isEmpty());
         saveDetailsWithHttpMethodAndSampleResultWithResponseCode("200");

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerHC4.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerHC4.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerHC4.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerHC4.java Tue Feb  2 21:39:15 2016
@@ -18,6 +18,12 @@
 
 package org.apache.jmeter.protocol.http.control;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.lang.reflect.Field;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -42,6 +48,9 @@ import org.apache.jmeter.junit.JMeterTes
 import org.apache.jmeter.protocol.http.control.CacheManager.CacheEntry;
 import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
 import org.apache.jmeter.protocol.http.util.HTTPConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Test {@link CacheManager} that uses HTTPHC4Impl
@@ -204,19 +213,14 @@ public class TestCacheManagerHC4 extends
     private HttpResponse httpResponse;
     private HTTPSampleResult sampleResultOK;
 
-    public TestCacheManagerHC4(String name) {
-        super(name);
-    }
-
     private String makeDate(Date d){
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
         simpleDateFormat.setTimeZone(GMT);
         return simpleDateFormat.format(d);
     }
 
-    @Override
+    @Before
     public void setUp() throws Exception {
-        super.setUp();
         this.cacheManager = new CacheManager();
         this.currentTimeInGMT = makeDate(new Date());
         this.url = new URL(LOCAL_HOST);
@@ -226,17 +230,17 @@ public class TestCacheManagerHC4 extends
         this.sampleResultOK = getSampleResultWithSpecifiedResponseCode("200");
     }
 
-    @Override
-    protected void tearDown() throws Exception {
+    @After
+    public void tearDown() throws Exception {
         //this.httpUrlConnection = null;
         this.httpMethod = null;
         this.url = null;
         this.cacheManager = null;
         this.currentTimeInGMT = null;
         this.sampleResultOK = null;
-        super.tearDown();
     }
 
+    @Test
     public void testExpiresHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -251,6 +255,7 @@ public class TestCacheManagerHC4 extends
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testCacheHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -266,6 +271,7 @@ public class TestCacheManagerHC4 extends
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
 
+    @Test
     public void testCacheVaryHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -280,6 +286,7 @@ public class TestCacheManagerHC4 extends
         this.vary = null;
     }
 
+    @Test
     public void testCacheHttpClientHEAD() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -294,6 +301,7 @@ public class TestCacheManagerHC4 extends
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testPrivateCacheHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -309,6 +317,7 @@ public class TestCacheManagerHC4 extends
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testPrivateCacheNoMaxAgeNoExpireHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -325,6 +334,7 @@ public class TestCacheManagerHC4 extends
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testPrivateCacheExpireNoMaxAgeHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -340,6 +350,7 @@ public class TestCacheManagerHC4 extends
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
 
+    @Test
     public void testNoCacheHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -351,6 +362,7 @@ public class TestCacheManagerHC4 extends
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testNoStoreHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -362,6 +374,7 @@ public class TestCacheManagerHC4 extends
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    @Test
     public void testCacheHttpClientBug51932() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -377,6 +390,7 @@ public class TestCacheManagerHC4 extends
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
 
+    @Test
     public void testGetClearEachIteration() throws Exception {
         assertFalse("Should default not to clear after each iteration.", this.cacheManager.getClearEachIteration());
         this.cacheManager.setClearEachIteration(true);
@@ -385,6 +399,7 @@ public class TestCacheManagerHC4 extends
         assertFalse("Should be settable not to clear after each iteration.", this.cacheManager.getClearEachIteration());
     }
 
+    @Test
     public void testSaveDetailsHttpMethodWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
         saveDetailsWithHttpMethodAndSampleResultWithResponseCode("200");
         CacheManager.CacheEntry cacheEntry = getThreadCacheEntry(this.httpMethod.getURI().toString());
@@ -393,11 +408,13 @@ public class TestCacheManagerHC4 extends
         assertEquals("Saving details with SampleResult & HttpMethod with 200 response should make cache entry with no last modified date.", this.currentTimeInGMT, cacheEntry.getLastModified());
     }
 
+    @Test
     public void testSaveDetailsHttpMethodWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
         saveDetailsWithHttpMethodAndSampleResultWithResponseCode("404");
         assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(url.toString()));
     }
 
+    @Test
     public void testSetHeadersHttpMethodWithSampleResultWithResponseCode200GivesCacheEntry() throws Exception {
         this.httpMethod.setURI(this.url.toURI());
         this.httpMethod.addHeader(new BasicHeader(HTTPConstants.IF_MODIFIED_SINCE, this.currentTimeInGMT));
@@ -408,6 +425,7 @@ public class TestCacheManagerHC4 extends
         checkRequestHeader(HTTPConstants.IF_MODIFIED_SINCE, this.currentTimeInGMT);
     }
 
+    @Test
     public void testSetHeadersHttpMethodWithSampleResultWithResponseCode404GivesNoCacheEntry() throws Exception {
         this.httpMethod.setURI(this.url.toURI());
         saveDetailsWithHttpMethodAndSampleResultWithResponseCode("404");
@@ -415,6 +433,7 @@ public class TestCacheManagerHC4 extends
         assertNull("Saving SampleResult with HttpMethod & 404 response should not make cache entry.", getThreadCacheEntry(url.toString()));
     }
 
+    @Test
     public void testClearCache() throws Exception {
         assertTrue("ThreadCache should be empty initially.", getThreadCache().isEmpty());
         saveDetailsWithHttpMethodAndSampleResultWithResponseCode("200");

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java Tue Feb  2 21:39:15 2016
@@ -18,6 +18,12 @@
 
 package org.apache.jmeter.protocol.http.control;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.net.URL;
 import java.util.List;
 
@@ -31,25 +37,23 @@ import org.apache.jmeter.protocol.http.u
 import org.apache.jmeter.threads.JMeterContext;
 import org.apache.jmeter.threads.JMeterContextService;
 import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 public class TestCookieManager extends JMeterTestCase {
         private CookieManager man = null;
 
-        public TestCookieManager(String name) {
-            super(name);
-        }
-
         private JMeterContext jmctx = null;
 
-        @Override
+        @Before
         public void setUp() throws Exception {
-            super.setUp();
             jmctx = JMeterContextService.getContext();
             man = new CookieManager();
             man.setThreadContext(jmctx);
             man.testStarted();// This is needed in order to set up the cookie policy
         }
 
+        @Test
         public void testRemoveCookie() throws Exception {
             man.setThreadContext(jmctx);
             Cookie c = new Cookie("id", "me", "127.0.0.1", "/", false, 0);
@@ -67,6 +71,7 @@ public class TestCookieManager extends J
             assertEquals(1, man.getCookieCount());
         }
 
+        @Test
         public void testSendCookie() throws Exception {
             man.add(new Cookie("id", "value", "jakarta.apache.org", "/", false, 9999999999L));
             HTTPSamplerBase sampler = new HTTPNullSampler();
@@ -76,6 +81,7 @@ public class TestCookieManager extends J
             assertNotNull(man.getCookieHeaderForURL(sampler.getUrl()));
         }
 
+        @Test
         public void testSendCookie2() throws Exception {
             man.add(new Cookie("id", "value", ".apache.org", "/", false, 9999999999L));
             HTTPSamplerBase sampler = new HTTPNullSampler();
@@ -94,6 +100,7 @@ public class TestCookieManager extends J
          *
          * @throws Exception if something fails
          */
+        @Test
         public void testDomainHandling() throws Exception {
             URL url = new URL("http://jakarta.apache.org/");
             man.addCookieFromHeader("test=1;domain=.jakarta.apache.org", url);
@@ -103,6 +110,7 @@ public class TestCookieManager extends J
         /**
          * @throws Exception
          */
+        @Test
         public void testAddCookieFromHeaderWithWildcard() throws Exception {
             URL url = new URL("https://subdomain.bt.com/page");
             String headerLine = "SMTRYNO=1; path=/; domain=.bt.com";
@@ -135,6 +143,7 @@ public class TestCookieManager extends J
         /**
          * @throws Exception
          */
+        @Test
         public void testAddCookieFromHeaderWithNoWildcard() throws Exception {
             URL url = new URL("https://subdomain.bt.com/page");
             String headerLine = "SMTRYNO=1; path=/";
@@ -162,6 +171,7 @@ public class TestCookieManager extends J
         /**
          * @throws Exception
          */
+        @Test
         public void testAddCookieFromHeaderWithWildcard2() throws Exception {
             URL url = new URL("https://www.bt.com/page");
             String headerLine = "SMTRYNO=1; path=/; domain=.bt.com";
@@ -185,6 +195,7 @@ public class TestCookieManager extends J
         /**
          * @throws Exception
          */
+        @Test
         public void testBug56358() throws Exception {
             URL url = new URL("http://remote.com:10008/get/cookie");
             String headerLine = "test=value;Max-age=120;path=/;Version=1";
@@ -206,6 +217,7 @@ public class TestCookieManager extends J
             }
         }
         
+        @Test
         public void testCrossDomainHandling() throws Exception {
             URL url = new URL("http://jakarta.apache.org/");
             assertEquals(0,man.getCookieCount()); // starts empty
@@ -221,6 +233,7 @@ public class TestCookieManager extends J
          *
          * @throws Exception if something fails
          */
+        @Test
         public void testSimilarHostNames() throws Exception {
             URL url = new URL("http://ache.org/");
             man.addCookieFromHeader("test=1", url);
@@ -229,6 +242,7 @@ public class TestCookieManager extends J
         }
 
         // Test session cookie is returned
+        @Test
         public void testSessionCookie() throws Exception {
             URL url = new URL("http://a.b.c/");
             man.addCookieFromHeader("test=1", url);
@@ -238,6 +252,7 @@ public class TestCookieManager extends J
         }
 
         // Bug 2063
+        @Test
         public void testCookieWithEquals() throws Exception {
             URL url = new URL("http://a.b.c/");
             man.addCookieFromHeader("NSCP_USER_LOGIN1_NEW=SHA=xxxxx", url);
@@ -250,6 +265,7 @@ public class TestCookieManager extends J
         }
 
         // Test Old cookie is not returned
+        @Test
         public void testOldCookie() throws Exception {
             URL url = new URL("http://a.b.c/");
             man.addCookieFromHeader("test=1; expires=Mon, 01-Jan-1990 00:00:00 GMT", url);
@@ -258,6 +274,7 @@ public class TestCookieManager extends J
         }
 
         // Test New cookie is returned
+        @Test
         public void testNewCookie() throws Exception {
             URL url = new URL("http://a.b.c/");
             man.addCookieFromHeader("test=1; expires=Mon, 01-Jan-2990 00:00:00 GMT", url);
@@ -268,6 +285,7 @@ public class TestCookieManager extends J
         }
 
         // Test multi-cookie header handling
+        @Test
         public void testCookies1() throws Exception {
             URL url = new URL("http://a.b.c.d/testCookies1");
             man.addCookieFromHeader("test1=1; comment=\"how,now\", test2=2; version=1", url);
@@ -277,6 +295,7 @@ public class TestCookieManager extends J
             assertEquals("test1=1; test2=2", s);
         }
         
+        @Test
         public void testCookies2() throws Exception {
             URL url = new URL("https://a.b.c.d/testCookies2");
             //The cookie in question does not have a version attribute mandatory for
@@ -291,6 +310,7 @@ public class TestCookieManager extends J
             assertEquals("test1=1", s);
         }
         
+        @Test
         public void testCookies3() throws Exception {
             URL url = new URL("https://a.b.c.d/testCookies2");
             man.addCookieFromHeader("test1=1;secure, test2=2;secure; version=1", url);
@@ -301,6 +321,7 @@ public class TestCookieManager extends J
         }
 
         // Test duplicate cookie handling
+        @Test
         public void testDuplicateCookie() throws Exception {
             URL url = new URL("http://a.b.c/");
             man.addCookieFromHeader("test=1", url);
@@ -312,6 +333,7 @@ public class TestCookieManager extends J
             assertNotNull(s);
             assertEquals("test=2", s);
         }
+        @Test
         public void testDuplicateCookie2() throws Exception {
             URL url = new URL("http://a.b.c/");
             man.addCookieFromHeader("test=1", url);
@@ -333,6 +355,7 @@ public class TestCookieManager extends J
          *
          * @throws Exception if something fails
          */
+        @Test
         public void testMissingPath0() throws Exception {
             URL url = new URL("http://d.e.f/goo.html");
             man.addCookieFromHeader("test=moo", url);
@@ -346,6 +369,7 @@ public class TestCookieManager extends J
          *
          * @throws Exception if something fails
          */
+        @Test
         public void testMissingPath1() throws Exception {
             URL url = new URL("http://d.e.f/moo.html");
             man.addCookieFromHeader("test=moo", url);
@@ -358,6 +382,7 @@ public class TestCookieManager extends J
          *
          * @throws Exception if something fails
          */
+        @Test
         public void testRootPath0() throws Exception {
             URL url = new URL("http://d.e.f/goo.html");
             man.addCookieFromHeader("test=moo;path=/", url);
@@ -370,6 +395,7 @@ public class TestCookieManager extends J
          *
          * @throws Exception if something fails
          */
+        @Test
         public void testRootPath1() throws Exception {
             URL url = new URL("http://d.e.f/moo.html");
             man.addCookieFromHeader("test=moo;path=/", url);
@@ -379,6 +405,7 @@ public class TestCookieManager extends J
         }
         
         // Test cookie matching
+        @Test
         public void testCookieMatching() throws Exception {
             URL url = new URL("http://a.b.c:8080/TopDir/fred.jsp");
             man.addCookieFromHeader("ID=abcd; Path=/TopDir", url);
@@ -403,6 +430,7 @@ public class TestCookieManager extends J
             assertNull(s);
         }
 
+        @Test
         public void testCookieOrdering1() throws Exception {
             URL url = new URL("http://order.now/sub1/moo.html");
             man.addCookieFromHeader("test1=moo1;path=/", url);
@@ -419,6 +447,7 @@ public class TestCookieManager extends J
             // assertEquals("test2=moo2; test1=moo1; test2=moo3", s);
         }
 
+        @Test
         public void testCookieOrdering2() throws Exception {
             URL url = new URL("http://order.now/sub1/moo.html");
             man.addCookieFromHeader("test1=moo1;", url);
@@ -442,7 +471,7 @@ public class TestCookieManager extends J
             assertEquals("test1=moo1; test2=moo2; test2=moo3", s);
         }
         
-        @SuppressWarnings("deprecation") // TODO drop this test at some point
+        @Test
         public void testCookiePolicy2109() throws Exception {
             man.setCookiePolicy(org.apache.http.client.params.CookiePolicy.RFC_2109);
             man.testStarted(); // ensure policy is picked up
@@ -469,6 +498,7 @@ public class TestCookieManager extends J
             assertEquals("$Version=0; test1=moo1; test2=moo2; $Path=/sub1; test2=moo3; $Path=/", s);
         }
 
+        @Test
         public void testCookiePolicyNetscape() throws Exception {
             man.setCookiePolicy(CookieSpecs.NETSCAPE);
             man.testStarted(); // ensure policy is picked up
@@ -496,6 +526,7 @@ public class TestCookieManager extends J
             assertEquals("test1=moo1; test2=moo2; test2=moo3", s);
         }
 
+        @Test
         public void testCookiePolicyIgnore() throws Exception {
             man.setCookiePolicy(CookieSpecs.IGNORE_COOKIES);
             man.testStarted(); // ensure policy is picked up
@@ -528,6 +559,7 @@ public class TestCookieManager extends J
             System.out.println("Uncomment assertEquals(0,c.size()) when migrating to httpclient-4.5.2");
         }
 
+        @Test
         public void testLoad() throws Exception{
             assertEquals(0,man.getCookieCount());
             man.addFile(findTestPath("testfiles/cookies.txt"));

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestDNSCacheManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestDNSCacheManager.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestDNSCacheManager.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestDNSCacheManager.java Tue Feb  2 21:39:15 2016
@@ -18,6 +18,8 @@
 
 package org.apache.jmeter.protocol.http.control;
 
+import static org.junit.Assert.fail;
+
 import java.net.UnknownHostException;
 
 import org.apache.jmeter.junit.JMeterTestCase;

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/gui/TestHttpTestSampleGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/gui/TestHttpTestSampleGui.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/gui/TestHttpTestSampleGui.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/gui/TestHttpTestSampleGui.java Tue Feb  2 21:39:15 2016
@@ -18,24 +18,21 @@
 
 package org.apache.jmeter.protocol.http.control.gui;
 
-import java.awt.GraphicsEnvironment;
-
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
 
+import java.awt.GraphicsEnvironment;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
+import org.junit.Before;
+import org.junit.Test;
 
-public class TestHttpTestSampleGui extends TestCase {
+public class TestHttpTestSampleGui {
     private static final Logger log = LoggingManager.getLoggerForClass();
 
     private HttpTestSampleGui gui;
 
-        public TestHttpTestSampleGui(String name) {
-            super(name);
-        }
-
-        @Override
+        @Before
         public void setUp() {
             if(GraphicsEnvironment.isHeadless()) {
                 System.out.println("Skipping test:"+getClass().getName()+", cannot run in Headless mode");
@@ -45,6 +42,7 @@ public class TestHttpTestSampleGui exten
             gui = new HttpTestSampleGui();
         }
 
+        @Test
         public void testCloneSampler() throws Exception {
             if(GraphicsEnvironment.isHeadless()) {
                 System.out.println("Skipping test:"+getClass().getName()+"#testCloneSampler"+", cannot run in Headless mode");

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java Tue Feb  2 21:39:15 2016
@@ -18,6 +18,9 @@
 
 package org.apache.jmeter.protocol.http.modifier;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -32,22 +35,21 @@ import org.apache.jmeter.save.SaveServic
 import org.apache.jmeter.threads.JMeterContext;
 import org.apache.jmeter.threads.JMeterContextService;
 import org.apache.jorphan.io.TextFile;
+import org.junit.Before;
+import org.junit.Test;
 
 public class TestAnchorModifier extends JMeterTestCase {
         private AnchorModifier parser = new AnchorModifier();
-        public TestAnchorModifier(String name) {
-            super(name);
-        }
 
         private JMeterContext jmctx = null;
 
-        @Override
+        @Before
         public void setUp() {
             jmctx = JMeterContextService.getContext();
             parser.setThreadContext(jmctx);
         }
 
-        public void testProcessingHTMLFile(String HTMLFileName) throws Exception {
+        private void testProcessingHTMLFile(String HTMLFileName) throws Exception {
             File file = new File(System.getProperty("user.dir") + "/testfiles/load_bug_list.jmx");
             HTTPSamplerBase config = (HTTPSamplerBase) SaveService.loadTree(file).getArray()[0];
             config.setRunningVersion(true);
@@ -84,18 +86,22 @@ public class TestAnchorModifier extends
                     + "&order=Reuse+same+sort+as+last+time", config.toString());
         }
 
+        @Test
         public void testModifySampler() throws Exception {
             testProcessingHTMLFile("/testfiles/jmeter_home_page.html");
         }
 
+        @Test
         public void testModifySamplerWithRelativeLink() throws Exception {
             testProcessingHTMLFile("/testfiles/jmeter_home_page_with_relative_links.html");
         }
 
+        @Test
         public void testModifySamplerWithBaseHRef() throws Exception {
             testProcessingHTMLFile("/testfiles/jmeter_home_page_with_base_href.html");
         }
 
+        @Test
         public void testSimpleParse() throws Exception {
             HTTPSamplerBase config = makeUrlConfig(".*/index\\.html");
             HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
@@ -114,6 +120,7 @@ public class TestAnchorModifier extends
         }
         
         // Test https works too
+        @Test
         public void testSimpleParse1() throws Exception {
             HTTPSamplerBase config = makeUrlConfig(".*/index\\.html");
             config.setProtocol(HTTPConstants.PROTOCOL_HTTPS);
@@ -133,6 +140,7 @@ public class TestAnchorModifier extends
             assertEquals("https://www.apache.org/subdir/index.html", config.getUrl().toString());
         }
 
+        @Test
         public void testSimpleParse2() throws Exception {
             HTTPSamplerBase config = makeUrlConfig("/index\\.html");
             HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
@@ -152,6 +160,7 @@ public class TestAnchorModifier extends
                     || "http://www.apache.org/subdir/lowerdir/index.html".equals(newUrl));
         }
 
+        @Test
         public void testSimpleParse3() throws Exception {
             HTTPSamplerBase config = makeUrlConfig(".*index.*");
             config.getArguments().addArgument("param1", "value1");
@@ -170,6 +179,7 @@ public class TestAnchorModifier extends
             assertEquals("http://www.apache.org/home/index.html?param1=value1", newUrl);
         }
 
+        @Test
         public void testSimpleParse4() throws Exception {
             HTTPSamplerBase config = makeUrlConfig("/subdir/index\\..*");
             HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
@@ -187,6 +197,7 @@ public class TestAnchorModifier extends
             assertEquals("http://www.apache.org/subdir/index.html", newUrl);
         }
 
+        @Test
         public void testSimpleParse5() throws Exception {
             HTTPSamplerBase config = makeUrlConfig("/subdir/index\\.h.*");
             HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/one/previous.html");
@@ -204,6 +215,7 @@ public class TestAnchorModifier extends
             assertEquals("http://www.apache.org/subdir/index.html", newUrl);
         }
 
+        @Test
         public void testFailSimpleParse1() throws Exception {
             HTTPSamplerBase config = makeUrlConfig(".*index.*?param2=.+1");
             HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
@@ -221,6 +233,7 @@ public class TestAnchorModifier extends
             assertEquals(newUrl, config.getUrl().toString());
         }
 
+        @Test
         public void testFailSimpleParse3() throws Exception {
             HTTPSamplerBase config = makeUrlConfig("/home/index.html");
             HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
@@ -238,6 +251,7 @@ public class TestAnchorModifier extends
             assertEquals(newUrl + "?param1=value1", config.getUrl().toString());
         }
 
+        @Test
         public void testFailSimpleParse2() throws Exception {
             HTTPSamplerBase config = makeUrlConfig(".*login\\.html");
             HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
@@ -255,6 +269,7 @@ public class TestAnchorModifier extends
             assertEquals(config.getUrl().toString(), newUrl);
         }
 
+        @Test
         public void testSimpleFormParse() throws Exception {
             HTTPSamplerBase config = makeUrlConfig(".*index.html");
             config.addArgument("test", "g.*");
@@ -275,6 +290,7 @@ public class TestAnchorModifier extends
             assertEquals("test=goto", config.getQueryString());
         }
 
+        @Test
         public void testBadCharParse() throws Exception {
             HTTPSamplerBase config = makeUrlConfig(".*index.html");
             config.addArgument("te$st", "g.*");
@@ -295,6 +311,7 @@ public class TestAnchorModifier extends
             assertEquals("te%24st=goto", config.getQueryString());
         }
 
+        @Test
         public void testSpecialCharParse() throws Exception {
         String specialChars = "-_.!~*'()%25";// These are some of the special characters
         String htmlEncodedFixture = URLEncoder.encode(specialChars, "UTF-8");

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java Tue Feb  2 21:39:15 2016
@@ -18,6 +18,8 @@
 
 package org.apache.jmeter.protocol.http.modifier;
 
+import static org.junit.Assert.assertEquals;
+
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.config.Arguments;
 import org.apache.jmeter.junit.JMeterTestCase;
@@ -29,6 +31,8 @@ import org.apache.jmeter.samplers.Sample
 import org.apache.jmeter.samplers.Sampler;
 import org.apache.jmeter.threads.JMeterContext;
 import org.apache.jmeter.threads.JMeterContextService;
+import org.junit.Before;
+import org.junit.Test;
 
 public class TestURLRewritingModifier extends JMeterTestCase {
         private SampleResult response = null;
@@ -37,17 +41,15 @@ public class TestURLRewritingModifier ex
 
         private URLRewritingModifier mod = null;
 
-        public TestURLRewritingModifier(String name) {
-            super(name);
-        }
 
-        @Override
+        @Before
         public void setUp() {
             context = JMeterContextService.getContext();
             mod = new URLRewritingModifier();
             mod.setThreadContext(context);
         }
 
+        @Test
         public void testNonHTTPSampler() throws Exception {
             Sampler sampler = new NullSampler();
             response = new SampleResult();
@@ -56,6 +58,7 @@ public class TestURLRewritingModifier ex
             mod.process();
         }
 
+        @Test
         public void testGrabSessionId() throws Exception {
             String html = "location: http://server.com/index.html" + "?session_id=jfdkjdkf%20jddkfdfjkdjfdf%22;";
             response = new SampleResult();
@@ -72,6 +75,7 @@ public class TestURLRewritingModifier ex
             assertEquals("http://server.com/index.html?" + "session_id=jfdkjdkf+jddkfdfjkdjfdf%22", sampler.toString());
         }
 
+        @Test
         public void testGrabSessionId2() throws Exception {
             String html = "<a href=\"http://server.com/index.html?" + "session_id=jfdkjdkfjddkfdfjkdjfdf\">";
             response = new SampleResult();
@@ -94,6 +98,7 @@ public class TestURLRewritingModifier ex
             return sampler;
         }
 
+        @Test
         public void testGrabSessionId3() throws Exception {
             String html = "href='index.html?session_id=jfdkjdkfjddkfdfjkdjfdf'";
             response = new SampleResult();
@@ -107,6 +112,7 @@ public class TestURLRewritingModifier ex
             assertEquals("jfdkjdkfjddkfdfjkdjfdf", ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
         }
         
+        @Test
         public void testGrabSessionId6() throws Exception {
             String html = "location: http://server.com/index.html" + "?session_id=bonjour+monsieur";
             response = new SampleResult();
@@ -123,6 +129,7 @@ public class TestURLRewritingModifier ex
             assertEquals("http://server.com/index.html?" + "session_id=bonjour+monsieur", sampler.toString());
         }
         
+        @Test
         public void testGrabSessionId7() throws Exception {
             String html = "location: http://server.com/index.html" + "?session_id=bonjour+monsieur";
             response = new SampleResult();
@@ -142,6 +149,7 @@ public class TestURLRewritingModifier ex
             assertEquals("http://server.com/index.html?" + "session_id=bonjour%2Bmonsieur", sampler.toString());
         }
 
+        @Test
         public void testGrabSessionIdFromXMLNonPatExtension() throws Exception { // Bug 50286
             String html = "<url>/some/path;jsessionid=123456789</url>";
             response = new SampleResult();
@@ -155,6 +163,7 @@ public class TestURLRewritingModifier ex
             assertEquals("123456789", ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
         }
 
+        @Test
         public void testGrabSessionIdFromXMLPatExtension() throws Exception { // Bug 50286
             String html = "<url>/some/path;jsessionid=123456789</url>";
             response = new SampleResult();
@@ -168,6 +177,7 @@ public class TestURLRewritingModifier ex
             assertEquals("index.html;jsessionid=123456789",sampler.getPath());
         }
 
+        @Test
         public void testGrabSessionIdEndedInTab() throws Exception {
             String html = "href='index.html?session_id=jfdkjdkfjddkfdfjkdjfdf\t";
             response = new SampleResult();
@@ -181,6 +191,7 @@ public class TestURLRewritingModifier ex
             assertEquals("jfdkjdkfjddkfdfjkdjfdf", ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
         }
 
+        @Test
         public void testGrabSessionId4() throws Exception {
             String html = "href='index.html;%24sid%24KQNq3AAADQZoEQAxlkX8uQV5bjqVBPbT'";
             response = new SampleResult();
@@ -196,6 +207,7 @@ public class TestURLRewritingModifier ex
             assertEquals("index.html;%24sid%24KQNq3AAADQZoEQAxlkX8uQV5bjqVBPbT", sampler.getPath());
         }
 
+        @Test
         public void testGrabSessionId5() throws Exception {
             String html = "location: http://server.com/index.html" + "?session[33]=jfdkjdkf%20jddkfdfjkdjfdf%22;";
             response = new SampleResult();
@@ -213,6 +225,7 @@ public class TestURLRewritingModifier ex
         }
 
 
+        @Test
         public void testGrabSessionIdFromForm() throws Exception {
             String[] html = new String[] { 
                     "<input name=\"sid\" value=\"myId\">", 
@@ -240,6 +253,7 @@ public class TestURLRewritingModifier ex
             }
         }
 
+    @Test
     public void testGrabSessionIdURLinJSON() throws Exception {
             String html = 
                 "<a href=\"#\" onclick=\"$(\'frame\').src=\'/index?param1=bla&sessionid=xyzxyzxyz\\'";
@@ -256,6 +270,7 @@ public class TestURLRewritingModifier ex
                     .getValue());
         }
 
+        @Test
         public void testCache() throws Exception {
             String[] html = new String[] { 
                     "<input name=\"sid\" value=\"myId\">", 
@@ -278,6 +293,7 @@ public class TestURLRewritingModifier ex
                         ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
             }
         }
+        @Test
         public void testNoCache() throws Exception {
             String[] html = new String[] { 
                     "<input name=\"sid\" value=\"myId\">",  "myId",

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHTMLParser.java Tue Feb  2 21:39:15 2016
@@ -34,14 +34,14 @@ import java.util.TreeSet;
 import java.util.Vector;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.jmeter.junit.JMeterTestCase;
+import org.apache.jmeter.junit.JMeterTestCaseJUnit3;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
 import junit.framework.TestSuite;
 
-public class TestHTMLParser extends JMeterTestCase {
+public class TestHTMLParser extends JMeterTestCaseJUnit3 {
     private static final Logger log = LoggingManager.getLoggerForClass();
 
     private static final String DEFAULT_UA  = "Apache-HttpClient/4.2.6";

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHtmlParsingUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHtmlParsingUtils.java?rev=1728221&r1=1728220&r2=1728221&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHtmlParsingUtils.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestHtmlParsingUtils.java Tue Feb  2 21:39:15 2016
@@ -18,31 +18,36 @@
 
 package org.apache.jmeter.protocol.http.parser;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.junit.JMeterTestCase;
 import org.apache.jmeter.protocol.http.sampler.HTTPNullSampler;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
+import org.junit.Before;
+import org.junit.Test;
 
 // TODO: need more tests
 public final class TestHtmlParsingUtils extends JMeterTestCase {
 
-        public TestHtmlParsingUtils(String name) {
-            super(name);
-        }
 
-        @Override
-        protected void setUp() {
+        @Before
+        public void setUp() {
         }
 
+        @Test
         public void testGetParser() throws Exception {
             HtmlParsingUtils.getParser();
         }
 
+        @Test
         public void testGetDom() throws Exception {
             HtmlParsingUtils.getDOM("<HTML></HTML>");
             HtmlParsingUtils.getDOM("");
         }
 
+        @Test
         public void testIsArgumentMatched() throws Exception {
             Argument arg = new Argument();
             Argument argp = new Argument();
@@ -57,6 +62,7 @@ public final class TestHtmlParsingUtils
             assertFalse(HtmlParsingUtils.isArgumentMatched(arg, argp));
         }
         
+        @Test
         public void testIsAnchorMatched() throws Exception {
             HTTPSamplerBase target=new HTTPNullSampler();
             HTTPSamplerBase pattern=new HTTPNullSampler();
@@ -91,6 +97,7 @@ public final class TestHtmlParsingUtils
             assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
         }
         
+        @Test
         public void testisEqualOrMatches() throws Exception {
             assertTrue(HtmlParsingUtils.isEqualOrMatches("http:","http:"));
             assertFalse(HtmlParsingUtils.isEqualOrMatches("http:","htTp:"));
@@ -98,6 +105,7 @@ public final class TestHtmlParsingUtils
             assertFalse(HtmlParsingUtils.isEqualOrMatches("ht+p:","http:"));
         }
 
+        @Test
         public void testisEqualOrMatchesCaseBlind() throws Exception {
             assertTrue(HtmlParsingUtils.isEqualOrMatchesCaseBlind("http:","http:"));
             assertTrue(HtmlParsingUtils.isEqualOrMatchesCaseBlind("http:","htTp:"));



Mime
View raw message