Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/io
In directory sc8-pr-cvs1:/tmp/cvs-serv30800/src/jdk/common/com/mockobjects/io
Modified Files:
MockFile.java
Log Message:
Added patch for isDirectory and isFile from Pat McGee
Index: MockFile.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/io/MockFile.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- MockFile.java 10 Apr 2003 10:34:44 -0000 1.6
+++ MockFile.java 25 Jun 2003 09:20:28 -0000 1.7
@@ -20,6 +20,8 @@
private final ReturnValue myParent = new ReturnValue("parent");
private final ReturnValue fileName = new ReturnValue("file name");
private final ReturnValue exists = new ReturnValue("exists");
+ private final ReturnValue isDirectory = new ReturnValue ("isDirectory");
+ private final ReturnValue isFile = new ReturnValue ("isFile");
private final ReturnValue mkdirs = new ReturnValue("mkdirs");
private final ReturnValue parentFile = new ReturnValue("parent file");
private final ExpectationCounter mkdirsCounter = new ExpectationCounter("mkdirs counter");
@@ -27,6 +29,7 @@
private final ReturnValue file = new ReturnValue("real file");
private final ReturnValue myPath = new ReturnValue("path");
private final ReturnValue absolutePath = new ReturnValue("absolute path");
+ private final ReturnValue length = new ReturnValue("length");
public void setupGetName(final String name) {
this.fileName.setValue(name);
@@ -125,15 +128,21 @@
public boolean exists() {
return exists.getBooleanValue();
}
+
+ public void setupIsDirectory(boolean isDir) {
+ this.isDirectory.setValue(isDir);
+ }
public boolean isDirectory() {
- notImplemented();
- return false;
+ return isDirectory.getBooleanValue();
+ }
+
+ public void setupIsFile(boolean isFile) {
+ this.isFile.setValue(isFile);
}
public boolean isFile() {
- notImplemented();
- return false;
+ return isFile.getBooleanValue();
}
public boolean isHidden() {
@@ -146,9 +155,12 @@
return 0;
}
+ public void setupLength(long length){
+ this.length.setValue(length);
+ }
+
public long length() {
- notImplemented();
- return 0;
+ return length.getLongValue();
}
public boolean createNewFile() throws IOException {
@@ -176,8 +188,7 @@
}
public File[] listFiles() {
- notImplemented();
- return new File[0];
+ return (File[]) myFilesToReturn.getValue();
}
public void setExpectedFilenameFilter(FilenameFilter aFilenameFilter) {
|