From: Jeff M. <cus...@us...> - 2002-05-07 16:31:53
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/io In directory usw-pr-cvs1:/tmp/cvs-serv8818/src/jdk/common/com/mockobjects/io Added Files: MockFile.java Log Message: Create mockable implementation of java.io.File --- NEW FILE: MockFile.java --- package com.mockobjects.io; import com.mockobjects.MockObject; import com.mockobjects.ExpectationValue; import java.io.IOException; import java.io.FilenameFilter; import java.io.FileFilter; import java.net.URL; import java.net.MalformedURLException; import alt.java.io.File; public class MockFile extends MockObject implements File { private final ExpectationValue myFilenameFilter = new ExpectationValue("filename filter"); private File[] myFilesToReturn; private java.io.File file; private String myPath; public String getName() { notImplemented(); return null; } public String getParent() { notImplemented(); return null; } public File getParentFile() { notImplemented(); return null; } public File createTempFile(String prefix, String suffix, File directory) throws IOException { notImplemented(); return null; } public File createTempFile(String prefix, String suffix) throws IOException { notImplemented(); return null; } public File[] listRoots() { notImplemented(); return new File[0]; } public void setupGetPath(String aPath){ myPath = aPath; } public String getPath() { return myPath; } public boolean isAbsolute() { notImplemented(); return false; } public String getAbsolutePath() { notImplemented(); return null; } public File getAbsoluteFile() { notImplemented(); return null; } public String getCanonicalPath() throws IOException { notImplemented(); return null; } public File getCanonicalFile() throws IOException { notImplemented(); return null; } public URL toURL() throws MalformedURLException { notImplemented(); return null; } public boolean canRead() { notImplemented(); return false; } public boolean canWrite() { notImplemented(); return false; } public boolean exists() { notImplemented(); return false; } public boolean isDirectory() { notImplemented(); return false; } public boolean isFile() { notImplemented(); return false; } public boolean isHidden() { notImplemented(); return false; } public long lastModified() { notImplemented(); return 0; } public long length() { notImplemented(); return 0; } public boolean createNewFile() throws IOException { notImplemented(); return false; } public boolean delete() { notImplemented(); return false; } public void deleteOnExit() { notImplemented(); } public String[] list() { notImplemented(); return new String[0]; } public String[] list(FilenameFilter filter) { notImplemented(); return new String[0]; } public File[] listFiles() { notImplemented(); return new File[0]; } public void setExpectedFilenameFilter(FilenameFilter aFilenameFilter){ myFilenameFilter.setExpected(aFilenameFilter); } public void setupListFile(File[] aFilesToReturn){ myFilesToReturn = aFilesToReturn; } public File[] listFiles(FilenameFilter aFilenameFilter) { myFilenameFilter.setActual(aFilenameFilter); return myFilesToReturn; } public File[] listFiles(FileFilter filter) { notImplemented(); return new File[0]; } public boolean mkdir() { notImplemented(); return false; } public boolean mkdirs() { notImplemented(); return false; } public boolean renameTo(File dest) { notImplemented(); return false; } public boolean setLastModified(long time) { notImplemented(); return false; } public boolean setReadOnly() { notImplemented(); return false; } public int compareTo(File pathname) { notImplemented(); return 0; } public int compareTo(Object o) { notImplemented(); return 0; } public void setupGetRealFile(java.io.File file){ this.file= file; } public java.io.File getRealFile() { return file; } } |