1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.owasp.dependencycheck.xml.pom;
19
20 import java.util.ArrayList;
21 import java.util.List;
22 import java.util.Properties;
23
24 import org.junit.Test;
25 import static org.junit.Assert.*;
26 import org.owasp.dependencycheck.BaseTest;
27
28
29
30
31
32 public class ModelTest extends BaseTest {
33
34
35
36
37 @Test
38 public void testGetName() {
39 Model instance = new Model();
40 instance.setName("");
41 String expResult = "";
42 String result = instance.getName();
43 assertEquals(expResult, result);
44 }
45
46
47
48
49 @Test
50 public void testSetName() {
51 String name = "";
52 Model instance = new Model();
53 instance.setName(name);
54 }
55
56
57
58
59 @Test
60 public void testGetOrganization() {
61 Model instance = new Model();
62 instance.setOrganization("");
63 String expResult = "";
64 String result = instance.getOrganization();
65 assertEquals(expResult, result);
66 }
67
68
69
70
71 @Test
72 public void testSetOrganization() {
73 String organization = "";
74 Model instance = new Model();
75 instance.setOrganization(organization);
76 }
77
78
79
80
81 @Test
82 public void testGetDescription() {
83 Model instance = new Model();
84 instance.setDescription("");
85 String expResult = "";
86 String result = instance.getDescription();
87 assertEquals(expResult, result);
88 }
89
90
91
92
93 @Test
94 public void testSetDescription() {
95 String description = "";
96 Model instance = new Model();
97 instance.setDescription(description);
98 }
99
100
101
102
103 @Test
104 public void testGetGroupId() {
105 Model instance = new Model();
106 instance.setGroupId("");
107 String expResult = "";
108 String result = instance.getGroupId();
109 assertEquals(expResult, result);
110 }
111
112
113
114
115 @Test
116 public void testSetGroupId() {
117 String groupId = "";
118 Model instance = new Model();
119 instance.setGroupId(groupId);
120 }
121
122
123
124
125 @Test
126 public void testGetArtifactId() {
127 Model instance = new Model();
128 instance.setArtifactId("");
129 String expResult = "";
130 String result = instance.getArtifactId();
131 assertEquals(expResult, result);
132 }
133
134
135
136
137 @Test
138 public void testSetArtifactId() {
139 String artifactId = "";
140 Model instance = new Model();
141 instance.setArtifactId(artifactId);
142 }
143
144
145
146
147 @Test
148 public void testGetVersion() {
149 Model instance = new Model();
150 instance.setVersion("");
151 String expResult = "";
152 String result = instance.getVersion();
153 assertEquals(expResult, result);
154 }
155
156
157
158
159 @Test
160 public void testSetVersion() {
161 String version = "";
162 Model instance = new Model();
163 instance.setVersion(version);
164 }
165
166
167
168
169 @Test
170 public void testGetParentGroupId() {
171 Model instance = new Model();
172 instance.setParentGroupId("");
173 String expResult = "";
174 String result = instance.getParentGroupId();
175 assertEquals(expResult, result);
176 }
177
178
179
180
181 @Test
182 public void testSetParentGroupId() {
183 String parentGroupId = "";
184 Model instance = new Model();
185 instance.setParentGroupId(parentGroupId);
186 }
187
188
189
190
191 @Test
192 public void testGetParentArtifactId() {
193 Model instance = new Model();
194 instance.setParentArtifactId("");
195 String expResult = "";
196 String result = instance.getParentArtifactId();
197 assertEquals(expResult, result);
198 }
199
200
201
202
203 @Test
204 public void testSetParentArtifactId() {
205 String parentArtifactId = "";
206 Model instance = new Model();
207 instance.setParentArtifactId(parentArtifactId);
208 }
209
210
211
212
213 @Test
214 public void testGetParentVersion() {
215 Model instance = new Model();
216 instance.setParentVersion("");
217 String expResult = "";
218 String result = instance.getParentVersion();
219 assertEquals(expResult, result);
220 }
221
222
223
224
225 @Test
226 public void testSetParentVersion() {
227 String parentVersion = "";
228 Model instance = new Model();
229 instance.setParentVersion(parentVersion);
230 }
231
232
233
234
235 @Test
236 public void testGetLicenses() {
237 Model instance = new Model();
238 instance.addLicense(new License("name", "url"));
239 List<License> expResult = new ArrayList<License>();
240 expResult.add(new License("name", "url"));
241 List<License> result = instance.getLicenses();
242 assertEquals(expResult, result);
243 }
244
245
246
247
248 @Test
249 public void testAddLicense() {
250 License license = new License("name", "url");
251 Model instance = new Model();
252 instance.addLicense(license);
253 }
254
255
256
257
258 @Test
259 public void testProcessProperties() {
260 Properties prop = new Properties();
261 prop.setProperty("key", "value");
262 prop.setProperty("nested", "nested ${key}");
263 String text = "This is a test of '${key}' '${nested}'";
264
265 Model instance = new Model();
266 instance.setName(text);
267 instance.processProperties(prop);
268 String expResults = "This is a test of 'value' 'nested value'";
269 assertEquals(expResults, instance.getName());
270 }
271
272
273
274
275 @Test
276 public void testInterpolateString() {
277 Properties prop = new Properties();
278 prop.setProperty("key", "value");
279 prop.setProperty("nested", "nested ${key}");
280 String text = "This is a test of '${key}' '${nested}'";
281 String expResults = "This is a test of 'value' 'nested value'";
282 String results = Model.interpolateString(text, prop);
283 assertEquals(expResults, results);
284 }
285
286 }