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