1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.basepom.mojo.propertyhelper;
16
17 import org.basepom.mojo.propertyhelper.macros.MacroType;
18
19 import java.io.File;
20 import java.util.Collections;
21 import java.util.Map;
22 import java.util.Properties;
23
24 import org.apache.maven.project.MavenProject;
25 import org.apache.maven.settings.Settings;
26
27
28
29
30 public interface FieldContext {
31
32
33 static FieldContext forTesting() {
34 return new FieldContext() {
35
36 @Override
37 public Map<String, MacroType> getMacros() {
38 return Collections.emptyMap();
39 }
40
41 @Override
42 public Properties getProjectProperties() {
43 return new Properties();
44 }
45
46 @Override
47 public MavenProject getProject() {
48 return new MavenProject();
49 }
50
51 @Override
52 public Settings getSettings() {
53 return new Settings();
54 }
55
56 @Override
57 public File getBasedir() {
58 throw new UnsupportedOperationException();
59 }
60
61 @Override
62 public InterpolatorFactory getInterpolatorFactory() {
63 return InterpolatorFactory.forTesting();
64 }
65
66 @Override
67 public TransformerRegistry getTransformerRegistry() {
68 return TransformerRegistry.INSTANCE;
69 }
70 };
71 }
72
73
74
75
76
77 Map<String, MacroType> getMacros();
78
79
80
81
82
83 Properties getProjectProperties();
84
85
86
87
88
89 MavenProject getProject();
90
91
92
93
94
95 Settings getSettings();
96
97
98
99
100
101
102 File getBasedir();
103
104
105
106
107
108 InterpolatorFactory getInterpolatorFactory();
109
110
111
112
113
114 TransformerRegistry getTransformerRegistry();
115 }