TESTMessageSerialization: use temporary file instead of hardcoded one
authorTomas Zeman <tzeman@volny.cz>
Fri, 06 Dec 2013 10:38:45 +0100
changeset 4 fa1ede9cc9d3
parent 3 b82b2a04d612
child 5 dfb094e7f626
TESTMessageSerialization: use temporary file instead of hardcoded one
classes/hirondelle/web4j/model/TESTMessageSerialization.java
--- a/classes/hirondelle/web4j/model/TESTMessageSerialization.java	Fri Dec 06 10:38:18 2013 +0100
+++ b/classes/hirondelle/web4j/model/TESTMessageSerialization.java	Fri Dec 06 10:38:45 2013 +0100
@@ -2,6 +2,7 @@
 
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -57,7 +58,8 @@
   // PRIVATE
   
   private  <T> void testSerializable(T aThing) throws FileNotFoundException, IOException, ClassNotFoundException  {
-    OutputStream file = new FileOutputStream( "C:\\Temp\\test.ser" );
+    File tmp = File.createTempFile("web4j", ".ser");
+    OutputStream file = new FileOutputStream(tmp);
     OutputStream buffer = new BufferedOutputStream( file );
     ObjectOutput output = new ObjectOutputStream( buffer );
     try{
@@ -67,7 +69,7 @@
       output.close();
     }
 
-    InputStream inFile = new FileInputStream( "C:\\Temp\\test.ser" );
+    InputStream inFile = new FileInputStream(tmp);
     InputStream inBuffer = new BufferedInputStream( inFile );
     ObjectInput input = new ObjectInputStream ( inBuffer );
     try{