1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs2.provider.res;
18
19 import static org.junit.jupiter.api.Assertions.assertThrows;
20 import static org.junit.jupiter.api.Assertions.assertTrue;
21
22 import java.net.URI;
23 import java.net.URISyntaxException;
24
25 import org.apache.commons.vfs2.FileSystemException;
26 import org.apache.commons.vfs2.VFS;
27 import org.junit.jupiter.api.Test;
28
29 public class ResSchemeTest {
30
31 @Test
32 public void testResolveFileString() throws FileSystemException {
33 assertTrue(VFS.getManager().resolveFile("res:test.properties").exists());
34 }
35
36 @Test
37 public void testResolveFileStringS() throws FileSystemException {
38 assertTrue(VFS.getManager().resolveFile("res:/test.properties").exists());
39 }
40
41 @Test
42 public void testResolveFileStringSS() throws FileSystemException {
43 assertTrue(VFS.getManager().resolveFile("res://test.properties").exists());
44 }
45
46 @Test
47 public void testResolveFileStringSSS() throws FileSystemException {
48 assertTrue(VFS.getManager().resolveFile("res://test.properties").exists());
49 }
50
51 @Test
52 public void testResolveFileStringSSSnull() {
53
54 assertThrows(FileSystemException.class, () -> VFS.getManager().resolveFile("res:///").exists());
55 }
56
57 @Test
58 public void testResolveFileURI() throws FileSystemException, URISyntaxException {
59 assertTrue(VFS.getManager().resolveFile(new URI("res:test.properties")).exists());
60 }
61
62 @Test
63 public void testResolveFileURIS() throws FileSystemException, URISyntaxException {
64 assertTrue(VFS.getManager().resolveFile(new URI("res:/test.properties")).exists());
65 }
66
67 @Test
68 public void testResolveFileURISS() throws FileSystemException, URISyntaxException {
69 assertTrue(VFS.getManager().resolveFile(new URI("res://test.properties")).exists());
70 }
71
72 @Test
73 public void testResolveFileURISSS() throws FileSystemException, URISyntaxException {
74 assertTrue(VFS.getManager().resolveFile(new URI("res://test.properties")).exists());
75 }
76
77 @Test
78 public void testResolveURIString() throws FileSystemException {
79 assertTrue(VFS.getManager().resolveURI("res:test.properties").isFile());
80 }
81
82 @Test
83 public void testResolveURIStringS() throws FileSystemException {
84 assertTrue(VFS.getManager().resolveURI("res:/test.properties").isFile());
85 }
86
87 @Test
88 public void testResolveURIStringSS() throws FileSystemException {
89 assertTrue(VFS.getManager().resolveURI("res://test.properties").isFile());
90 }
91
92 @Test
93 public void testResolveURIStringSSS() throws FileSystemException {
94 assertTrue(VFS.getManager().resolveURI("res:///test.properties").isFile());
95 }
96
97 @Test
98 public void testResolveURIStringSSSnull() {
99
100 assertThrows(FileSystemException.class, () -> VFS.getManager().resolveURI("res:///").isFile());
101 }
102
103 }