This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
commit 8ff11703acdb211322edf59c679ac577f9778374 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu Feb 4 21:36:03 2021 -0500 Move test packages to the same level as their main counterparts. This removes the ".test" --- .../vfs2/impl/DefaultFileSystemManagerTest.java | 41 ++++++++++++++ .../impl/test/DefaultFileSystemManagerTest.java | 66 ---------------------- 2 files changed, 41 insertions(+), 66 deletions(-) diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java index 8a1f2c0..4c22157 100644 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java +++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java @@ -17,9 +17,12 @@ package org.apache.commons.vfs2.impl; +import java.io.File; import java.nio.file.Paths; import org.apache.commons.vfs2.CacheStrategy; +import org.apache.commons.vfs2.FileName; +import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; @@ -73,4 +76,42 @@ public class DefaultFileSystemManagerTest { Assert.assertThrows(FileSystemException.class, () -> fileSystemManager.resolveFile("ram2:///")); } } + + /** + * Even if the file name is absolute, the base file must be given. This is an inconsistency in the API, but it is + * documented as such. + * + * @see "VFS-519" + */ + @Test(expected = NullPointerException.class) + public void testResolveFileAbsoluteThrows() throws FileSystemException { + final String absolute = new File("/").getAbsoluteFile().toURI().toString(); + VFS.getManager().resolveFile((File) null, absolute); + } + + /** + * If the base name is {@code null}, the file system manager should fail throwing a FileSystemException. + * + * @see VFS-189 + */ + @Test(expected = FileSystemException.class) + public void testResolveFileNameNull() throws FileSystemException { + VFS.getManager().resolveName((FileName) null, "../"); + } + + @Test + public void testResolveFileObjectNullAbsolute() throws FileSystemException { + final String absolute = new File("/").getAbsoluteFile().toURI().toString(); + VFS.getManager().resolveFile((FileObject) null, absolute); + } + + @Test(expected = FileSystemException.class) + public void testResolveFileObjectRelativeThrows() throws FileSystemException { + VFS.getManager().resolveFile((FileObject) null, "relativePath"); + } + + @Test(expected = NullPointerException.class) + public void testResolveFileRelativeThrows() throws FileSystemException { + VFS.getManager().resolveFile((File) null, "relativePath"); + } } diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileSystemManagerTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileSystemManagerTest.java deleted file mode 100644 index 5f228ca..0000000 --- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/test/DefaultFileSystemManagerTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.vfs2.impl.test; - -import java.io.File; - -import org.apache.commons.vfs2.FileName; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.VFS; -import org.junit.Test; - -public class DefaultFileSystemManagerTest { - - @Test(expected = NullPointerException.class) - public void testResolveFileRelativeThrows() throws FileSystemException { - VFS.getManager().resolveFile((File) null, "relativePath"); - } - - /** - * Even if the file name is absolute, the base file must be given. This is an inconsistency in the API, but it is - * documented as such. - * - * @see "VFS-519" - */ - @Test(expected = NullPointerException.class) - public void testResolveFileAbsoluteThrows() throws FileSystemException { - final String absolute = new File("/").getAbsoluteFile().toURI().toString(); - VFS.getManager().resolveFile((File) null, absolute); - } - - @Test(expected = FileSystemException.class) - public void testResolveFileObjectRelativeThrows() throws FileSystemException { - VFS.getManager().resolveFile((FileObject) null, "relativePath"); - } - - @Test - public void testResolveFileObjectNullAbsolute() throws FileSystemException { - final String absolute = new File("/").getAbsoluteFile().toURI().toString(); - VFS.getManager().resolveFile((FileObject) null, absolute); - } - - /** - * If the base name is {@code null}, the file system manager should fail throwing a FileSystemException. - * - * @see VFS-189 - */ - @Test(expected = FileSystemException.class) - public void testResolveFileNameNull() throws FileSystemException { - VFS.getManager().resolveName((FileName) null, "../"); - } -}