1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.owasp.dependencycheck;
19
20 import org.junit.After;
21 import org.junit.AfterClass;
22 import org.junit.Before;
23 import org.junit.BeforeClass;
24 import org.junit.Test;
25 import static org.junit.Assert.*;
26
27
28
29
30
31 public class AppTest {
32
33 public AppTest() {
34 }
35
36 @BeforeClass
37 public static void setUpClass() {
38 }
39
40 @AfterClass
41 public static void tearDownClass() {
42 }
43
44 @Before
45 public void setUp() {
46 }
47
48 @After
49 public void tearDown() {
50 }
51
52
53
54
55 @Test
56 public void testEnsureCanonicalPath() {
57 String file = "../*.jar";
58 App instance = new App();
59 String result = instance.ensureCanonicalPath(file);
60 assertFalse(result.contains(".."));
61 assertTrue(result.endsWith("*.jar"));
62 }
63
64
65
66
67 @Test
68 public void testEnsureCanonicalPath2() {
69 String file = "../some/skip/../path/file.txt";
70 App instance = new App();
71 String expResult = "/some/path/file.txt";
72 String result = instance.ensureCanonicalPath(file);
73 assertTrue("result=" + result, result.endsWith(expResult));
74 }
75 }