1 package org.apache.maven.plugin.resources;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.plugin.resources.stub.MavenProjectBasicStub;
23 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
24
25 public class ReflectionPropertiesTest
26 extends AbstractMojoTestCase
27 {
28
29 final static protected String pomFilePath = "/target/test-classes/unit/reflectionproperties-test/plugin-config.xml";
30
31
32 protected void setUp()
33 throws Exception
34 {
35 super.setUp();
36 }
37
38 protected void tearDown()
39 throws Exception
40 {
41
42 }
43
44 public void testGet_escapeBackslashCharacterInPath()
45 throws Exception
46 {
47
48 MavenProjectBasicStub project = new MavenProjectBasicStub( "escapeBackSlashCharacterInPath" );
49
50
51 project.setDescription( "c:\\\\org\\apache\\test" );
52
53 ReflectionProperties reflectProp = new ReflectionProperties( project, true );
54
55
56 String reflectPropValue = (String) reflectProp.get( "description" );
57
58
59 assertTrue( reflectPropValue.equals( "c\\:\\\\\\\\org\\\\apache\\\\test" ) );
60 }
61
62 public void testGet_dontEscapeBackslashCharacterInPath()
63 throws Exception
64 {
65
66 MavenProjectBasicStub project = new MavenProjectBasicStub( "dontEscapeBackSlashCharacterInPath" );
67
68
69 project.setDescription( "c:\\\\org\\apache\\test" );
70
71
72 ReflectionProperties reflectProp = new ReflectionProperties( project, false );
73
74
75 String reflectPropValue = (String) reflectProp.get( "description" );
76
77
78 assertTrue( reflectPropValue.equals( "c:\\\\org\\apache\\test" ) );
79 }
80 }