package com.darwinsys.todo.test;

import static org.junit.Assert.*;

import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import org.junit.Before;
import org.junit.Test;

import com.darwinsys.todo.model.Date;

public class DateSerializeTest {
	
	static final String FILENAME = "/tmp/sss"; // XXX use file.makeTempFile()

	final Date origDate = new Date(2014, 05, 06);
	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void test() throws Exception {
		ObjectOutputStream os = new ObjectOutputStream(
                new BufferedOutputStream(
                        new FileOutputStream(FILENAME)));
        os.writeObject(origDate);
        os.close();
        
        ObjectInputStream is = new ObjectInputStream(
                new FileInputStream(FILENAME));
        Date d2 = (Date) is.readObject();
        is.close();
        System.out.println(d2);
        assertEquals(origDate.getYear(), d2.getYear());
	}

}

@@ -91,32 +91,53 @@
 edOutputStream;%0A
+import java.io.File;%0A
 import java.io.F
@@ -144,32 +144,32 @@
 ileInputStream;%0A
-
 import java.io.F
@@ -177,32 +177,60 @@
 leOutputStream;%0A
+import java.io.IOException;%0A
 import java.io.O
@@ -424,68 +424,213 @@
 nal 
-String FILENAME = %22/tmp/sss%22; // XXX use file.makeTempFile()
+File TEMPFILE;%0A%09static %7B%0A%09%09try %7B%0A%09%09%09TEMPFILE = File.createTempFile(%22abc%22, %22def%22);%0A%09%09%09TEMPFILE.delete();%0A%09%09%7D catch(IOException e) %7B%0A%09%09%09throw new ExceptionInInitializerError(%22Canna create temp file%22);%0A%09%09%7D%0A%09%7D
 %0A%0A%09f
@@ -910,23 +910,23 @@
 tStream(
-FILENAM
+TEMPFIL
 E)));%0A  
@@ -1080,15 +1080,15 @@
 eam(
-FILENAM
+TEMPFIL
 E));

Use File.createTempFile() instead of hardcoded path.