1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.assembly.io;
20
21 import org.junit.Test;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25
26
27
28
29 public class PrefixedClasspathLocatorStrategyTest {
30
31 private MessageHolder mh = new DefaultMessageHolder();
32
33 @Test
34 public void testResolvePrefixWithLeadingSlashAndWithTrailingSlash() {
35 LocatorStrategy ls = new PrefixedClasspathLocatorStrategy("/assemblies/");
36 Location location = ls.resolve("empty.xml", mh);
37
38 assertNotNull(location);
39 assertEquals(0, mh.size());
40 }
41
42 @Test
43 public void testResolvePrefixWithLeadingSlashAndWithoutTrailingSlash() {
44 LocatorStrategy ls = new PrefixedClasspathLocatorStrategy("/assemblies");
45 Location location = ls.resolve("empty.xml", mh);
46
47 assertNotNull(location);
48 assertEquals(0, mh.size());
49 }
50
51 @Test
52 public void testResolvePrefixWithoutLeadingSlashAndWithTrailingSlash() {
53 LocatorStrategy ls = new PrefixedClasspathLocatorStrategy("assemblies/");
54 Location location = ls.resolve("empty.xml", mh);
55
56 assertNotNull(location);
57 assertEquals(0, mh.size());
58 }
59
60 @Test
61 public void testResolvePrefixWithoutLeadingSlashAndWithoutTrailingSlash() {
62 LocatorStrategy ls = new PrefixedClasspathLocatorStrategy("assemblies");
63 Location location = ls.resolve("empty.xml", mh);
64
65 assertNotNull(location);
66 assertEquals(0, mh.size());
67 }
68 }