You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2007/05/19 16:29:14 UTC

svn commit: r539762 - /jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java

Author: sebb
Date: Sat May 19 07:29:13 2007
New Revision: 539762

URL: http://svn.apache.org/viewvc?view=rev&rev=539762
Log:
New tests for constructor(boolean) and setFormatter()

Modified:
    jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java

Modified: jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java?view=diff&rev=539762&r1=539761&r2=539762
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java (original)
+++ jakarta/jmeter/branches/rel-2-2/test/src/org/apache/jmeter/samplers/TestSampleSaveConfiguration.java Sat May 19 07:29:13 2007
@@ -18,9 +18,12 @@
 
 package org.apache.jmeter.samplers;
 
-import junit.framework.TestCase;
+import java.text.SimpleDateFormat;
 
-public class TestSampleSaveConfiguration extends TestCase {    
+import org.apache.jmeter.junit.JMeterTestCase;
+
+// Extends JMeterTest case because it needs access to JMeter properties
+public class TestSampleSaveConfiguration extends JMeterTestCase {    
     public TestSampleSaveConfiguration(String name) {
         super(name);
     }
@@ -90,5 +93,47 @@
         assertFalse(a.hashCode() == b.hashCode());
         assertFalse(a.saveAssertions() == b.saveAssertions());
     }
-}
+
+    public void testFalse() throws Exception {
+        SampleSaveConfiguration a = new SampleSaveConfiguration(false);
+        SampleSaveConfiguration b = new SampleSaveConfiguration(false);
+        assertTrue("Hash codes should be equal",a.hashCode() == b.hashCode());
+        assertTrue("Objects should be equal",a.equals(b));
+        assertTrue("Objects should be equal",b.equals(a));
+    }
+
+    public void testTrue() throws Exception {
+        SampleSaveConfiguration a = new SampleSaveConfiguration(true);
+        SampleSaveConfiguration b = new SampleSaveConfiguration(true);
+        assertTrue("Hash codes should be equal",a.hashCode() == b.hashCode());
+        assertTrue("Objects should be equal",a.equals(b));
+        assertTrue("Objects should be equal",b.equals(a));
+    }
+    public void testFalseTrue() throws Exception {
+        SampleSaveConfiguration a = new SampleSaveConfiguration(false);
+        SampleSaveConfiguration b = new SampleSaveConfiguration(true);
+        assertFalse("Hash codes should not be equal",a.hashCode() == b.hashCode());
+        assertFalse("Objects should not be equal",a.equals(b));
+        assertFalse("Objects should not be equal",b.equals(a));
+    }
+
+    public void testFormatter() throws Exception {
+        SampleSaveConfiguration a = new SampleSaveConfiguration(false);
+        SampleSaveConfiguration b = new SampleSaveConfiguration(false);
+        a.setFormatter(null);
+        assertTrue("Hash codes should be equal",a.hashCode() == b.hashCode());
+        assertTrue("Objects should be equal",a.equals(b));
+        assertTrue("Objects should be equal",b.equals(a));
+        b.setFormatter(null);
+        assertTrue("Hash codes should be equal",a.hashCode() == b.hashCode());
+        assertTrue("Objects should be equal",a.equals(b));
+        assertTrue("Objects should be equal",b.equals(a));
+        a.setFormatter(new SimpleDateFormat());
+        b.setFormatter(new SimpleDateFormat());
+        assertTrue("Hash codes should be equal",a.hashCode() == b.hashCode());
+        assertTrue("Objects should be equal",a.equals(b));
+        assertTrue("Objects should be equal",b.equals(a));
+    }
+
+ }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org