01: /*
02: * Created on 2004-sep-24
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07: package org.drftpd.remotefile;
08:
09: import junit.framework.TestCase;
10:
11: import java.io.FileNotFoundException;
12:
13: import java.util.Stack;
14:
15: /**
16: * @author mog
17: * @version $Id: FileUtilsTest.java 847 2004-12-02 03:32:41Z mog $
18: */
19: public class FileUtilsTest extends TestCase {
20: public FileUtilsTest(String fName) {
21: super (fName);
22: }
23:
24: public void testGetSubdirofDirectoryLevel()
25: throws FileNotFoundException {
26: LinkedRemoteFile root = new LinkedRemoteFile(null);
27: Stack s = new Stack();
28: s.push(root);
29: s.push(((LinkedRemoteFile) s.peek())
30: .addFile(new StaticRemoteFile("dir1", null)));
31: s.push(((LinkedRemoteFile) s.peek())
32: .addFile(new StaticRemoteFile("dir2", null)));
33: s.push(((LinkedRemoteFile) s.peek())
34: .addFile(new StaticRemoteFile("dir3", null)));
35: s.push(((LinkedRemoteFile) s.peek())
36: .addFile(new StaticRemoteFile("dir4", null)));
37:
38: assertEquals(root, FileUtils.getSubdirOfDirectory(root, root));
39: assertEquals(s.get(1), FileUtils.getSubdirOfDirectory(root,
40: (LinkedRemoteFileInterface) s.peek()));
41: }
42: }
|