KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > vfs > provider > local > test > FileNameTests


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.vfs.provider.local.test;
17
18 import org.apache.commons.vfs.FileObject;
19 import org.apache.commons.vfs.test.AbstractProviderTestCase;
20
21 import java.io.File JavaDoc;
22
23 /**
24  * Additional naming tests for local file system.
25  *
26  * @author <a HREF="mailto:adammurdoch@apache.org">Adam Murdoch</a>
27  */

28 public class FileNameTests
29     extends AbstractProviderTestCase
30 {
31     /**
32      * Tests resolution of an absolute file name.
33      */

34     public void testAbsoluteFileName() throws Exception JavaDoc
35     {
36         // Locate file by absolute file name
37
String JavaDoc fileName = new File JavaDoc("testdir").getAbsolutePath();
38         FileObject absFile = getManager().resolveFile(fileName);
39
40         // Locate file by URI
41
String JavaDoc uri = "file://" + fileName.replace(File.separatorChar, '/');
42         FileObject uriFile = getManager().resolveFile(uri);
43
44         assertSame("file object", absFile, uriFile);
45     }
46 }
47
Popular Tags