harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r721896 - /harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeSupportTest.java
Date Sun, 30 Nov 2008 21:08:52 GMT
Author: ndbeyer
Date: Sun Nov 30 13:08:52 2008
New Revision: 721896

URL: http://svn.apache.org/viewvc?rev=721896&view=rev
Log:
use a temp file and clean it up; delete unnecessary junit methods

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeSupportTest.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeSupportTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeSupportTest.java?rev=721896&r1=721895&r2=721896&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeSupportTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeSupportTest.java
Sun Nov 30 13:08:52 2008
@@ -22,6 +22,7 @@
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeListenerProxy;
 import java.beans.PropertyChangeSupport;
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -29,10 +30,7 @@
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 
-import junit.framework.Test;
 import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
 
 import org.apache.harmony.beans.tests.support.NonSerializablePropertyChangeListener;
 import org.apache.harmony.beans.tests.support.SerializablePropertyChangeListener;
@@ -46,6 +44,18 @@
  */
 public class PropertyChangeSupportTest extends TestCase {
 
+    private File tempFile;
+    
+    @Override
+    protected void setUp() throws Exception {
+        tempFile = File.createTempFile("beans", ".ser");
+    }
+    
+    @Override
+    protected void tearDown() throws Exception {
+        tempFile.delete();
+        tempFile = null;
+    }
     /*
      * Test the constructor with a normal parameter.
      */
@@ -1451,24 +1461,10 @@
         readPropertyChangeListeners();
     }
 
-    /**
-     * 
-     */
-    public static Test suite() {
-        return new TestSuite(PropertyChangeSupportTest.class);
-    }
-
-    /**
-     * 
-     */
-    public static void main(String[] args) {
-        TestRunner.run(suite());
-    }
-
     private void writePropertyChangeListeners(PropertyChangeListener[] array) {
         ObjectOutputStream oos = null;
         try {
-            oos = new ObjectOutputStream(new FileOutputStream("x.ser"));
+            oos = new ObjectOutputStream(new FileOutputStream(tempFile));
             PropertyChangeSupport pcs = new PropertyChangeSupport("bean");
             if (array != null && array.length > 0) {
                 for (PropertyChangeListener element : array) {
@@ -1496,7 +1492,7 @@
         ObjectInputStream ois = null;
         PropertyChangeSupport pcs = null;
         try {
-            ois = new ObjectInputStream(new FileInputStream("x.ser"));
+            ois = new ObjectInputStream(new FileInputStream(tempFile));
             pcs = (PropertyChangeSupport) ois.readObject();
         } finally {
             if (ois != null) {



Mime
View raw message