Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/io
In directory sc8-pr-cvs1:/tmp/cvs-serv32150/src/jdk/common/com/mockobjects/io
Modified Files:
MockIOFactory.java
Log Message:
Change MockIOFactory to use bags for streams
Index: MockIOFactory.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/io/MockIOFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MockIOFactory.java 2 Jan 2003 16:04:31 -0000 1.1
+++ MockIOFactory.java 17 Jan 2003 17:10:33 -0000 1.2
@@ -5,40 +5,33 @@
import com.mockobjects.ExpectationValue;
import com.mockobjects.MockObject;
import com.mockobjects.ReturnValue;
+import com.mockobjects.ReturnObjectBag;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.OutputStream;
public class MockIOFactory extends MockObject implements IOFactory {
- private final ExpectationValue myFile = new ExpectationValue("file");
- private final ReturnValue inputStream = new ReturnValue("input stream");
- private final ReturnValue outputStream = new ReturnValue("output stream");
+ private final ReturnObjectBag inputStream = new ReturnObjectBag("input stream");
+ private final ReturnObjectBag outputStream = new ReturnObjectBag("output stream");
private final ReturnValue file = new ReturnValue("file");
private final ExpectationValue fileName = new ExpectationValue("file name");
- public void setExpectedFile(File aFile) {
- myFile.setExpected(aFile);
- }
-
- public void setupInputStream(InputStream inputStream) {
- this.inputStream.setValue(inputStream);
+ public void setupInputStream(File expectedFile, InputStream returnStream) {
+ this.inputStream.putObjectToReturn(expectedFile, returnStream);
}
public InputStream createInputStream(File aFile) throws FileNotFoundException {
- myFile.setActual(aFile);
-
- return (InputStream)inputStream.getValue();
+ return (InputStream)inputStream.getNextReturnObject(aFile);
}
- public void setupOutputStream(OutputStream outputStream) {
- this.outputStream.setValue(outputStream);
+ public void setupOutputStream(File expectedFile, OutputStream returnStream) {
+ this.outputStream.putObjectToReturn(expectedFile, outputStream);
}
public OutputStream createOutputStream(File aFile) throws FileNotFoundException {
- myFile.setActual(aFile);
- return (OutputStream)outputStream.getValue();
+ return (OutputStream)outputStream.getNextReturnObject(aFile);
}
public void setupCreateFile(File file) {
@@ -53,5 +46,4 @@
this.fileName.setActual(fileName);
return (File)file.getValue();
}
-
}
|