1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package net.sf.statcvs.util;
24
25 import junit.framework.TestCase;
26
27 /**
28 * Test cases for {@link net.sf.statcvs.util.FileUtils}
29 *
30 * @author Richard Cyganiak
31 * @version $Id: FileUtilsTest.java,v 1.3 2008/04/02 11:22:15 benoitx Exp $
32 */
33 public class FileUtilsTest extends TestCase {
34
35 /**
36 * Constructor for OutputUtilsTest.
37 * @param arg0 input
38 */
39 public FileUtilsTest(final String arg0) {
40 super(arg0);
41 }
42
43 /**
44 * Tests {@link FileUtils#getDirectoryName}
45 */
46 public void testGetDirectoryName() {
47 assertEquals("statcvs", FileUtils.getDirectoryName("net/sf/statcvs/"));
48 assertEquals("sf", FileUtils.getDirectoryName("net/sf/"));
49 assertEquals("net", FileUtils.getDirectoryName("net/"));
50 try {
51 FileUtils.getDirectoryName("");
52 fail("can't get directory name for root");
53 } catch (final IllegalArgumentException expected) {
54
55 }
56 }
57
58 /**
59 * Tests {@link FileUtils#getDirectoryName}
60 */
61 public void testGetParentDirectoryPath() {
62 assertEquals("net/sf/", FileUtils.getParentDirectoryPath("net/sf/statcvs/"));
63 assertEquals("net/", FileUtils.getParentDirectoryPath("net/sf/"));
64 assertEquals("", FileUtils.getParentDirectoryPath("net/"));
65 try {
66 FileUtils.getParentDirectoryPath("");
67 fail("can't get parent directory for root");
68 } catch (final IllegalArgumentException expected) {
69
70 }
71 }
72 }