1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package net.sourceforge.plantumldependency.cli.main.ant;
26
27 import static java.util.logging.Level.INFO;
28 import static net.sourceforge.plantumldependency.cli.constants.PlantUMLDependencyConstants.DEFAULT_DISPLAY_NAME_OPTIONS_STRING;
29 import static net.sourceforge.plantumldependency.cli.constants.PlantUMLDependencyConstants.DEFAULT_DISPLAY_PACKAGE_NAME_OPTIONS_STRING;
30 import static net.sourceforge.plantumldependency.cli.constants.PlantUMLDependencyConstants.DEFAULT_DISPLAY_TYPES_OPTIONS_STRING;
31 import static net.sourceforge.plantumldependency.cli.constants.PlantUMLDependencyConstants.DEFAULT_EXCLUDE_OPTIONS;
32 import static net.sourceforge.plantumldependency.cli.constants.PlantUMLDependencyConstants.DEFAULT_INCLUDE_OPTIONS;
33 import static net.sourceforge.plantumldependency.cli.main.option.programminglanguage.PlantUMLDependencyProgrammingLanguageOption.DEFAULT_PROGRAMMING_LANGUAGE;
34 import static net.sourceforge.plantumldependency.common.constants.CharacterConstants.DOT_CHAR;
35 import static net.sourceforge.plantumldependency.common.constants.CommonFileConstants.TXT_EXTENSION;
36 import static org.junit.Assert.assertEquals;
37
38 import org.junit.Test;
39
40
41
42
43
44
45
46
47 public class PlantUMLDependencyProgramTaskTest {
48
49
50 public static final PlantUMLDependencyProgramTask PLANTUML_DEPENDENCY_TASK1 = new PlantUMLDependencyProgramTask();
51
52
53 public static final PlantUMLDependencyProgramTask PLANTUML_DEPENDENCY_TASK2 = createPlantUMLDependencyTask1();
54
55
56
57
58
59
60
61 private static PlantUMLDependencyProgramTask createPlantUMLDependencyTask1() {
62 final PlantUMLDependencyProgramTask task = new PlantUMLDependencyProgramTask();
63 task.setBaseDir(DOT_CHAR);
64 task.setDisplayType(DEFAULT_DISPLAY_TYPES_OPTIONS_STRING);
65 task.setDisplayName(DEFAULT_DISPLAY_NAME_OPTIONS_STRING);
66 task.setDisplayPackageName(DEFAULT_DISPLAY_PACKAGE_NAME_OPTIONS_STRING);
67 task.setExcludes(DEFAULT_EXCLUDE_OPTIONS);
68 task.setIncludes(DEFAULT_INCLUDE_OPTIONS + DEFAULT_PROGRAMMING_LANGUAGE.getName());
69 task.setOutput("plantuml" + TXT_EXTENSION);
70 task.setProgrammingLanguage(DEFAULT_PROGRAMMING_LANGUAGE.getName());
71 task.setVerboseLevel(INFO.getName());
72 return task;
73 }
74
75
76
77
78
79
80 @Test
81 public void testExecute() {
82
83 }
84
85
86
87
88
89
90 @Test
91 public void testGetBaseDir() {
92 assertEquals(DOT_CHAR, PLANTUML_DEPENDENCY_TASK2.getBaseDir());
93 }
94
95
96
97
98
99
100 @Test
101 public void testGetDisplayName() {
102 assertEquals(".*", PLANTUML_DEPENDENCY_TASK2.getDisplayName());
103 }
104
105
106
107
108
109
110 @Test
111 public void testGetDisplayPackageName() {
112 assertEquals(".*", PLANTUML_DEPENDENCY_TASK2.getDisplayPackageName());
113 }
114
115
116
117
118
119
120 @Test
121 public void testGetDisplayType() {
122 assertEquals(DEFAULT_DISPLAY_TYPES_OPTIONS_STRING, PLANTUML_DEPENDENCY_TASK2.getDisplayType());
123 }
124
125
126
127
128
129
130 @Test
131 public void testGetExcludes() {
132 assertEquals(DEFAULT_EXCLUDE_OPTIONS, PLANTUML_DEPENDENCY_TASK2.getExcludes());
133 }
134
135
136
137
138
139
140 @Test
141 public void testGetIncludes() {
142 assertEquals(DEFAULT_INCLUDE_OPTIONS + DEFAULT_PROGRAMMING_LANGUAGE.getName(),
143 PLANTUML_DEPENDENCY_TASK2.getIncludes());
144 }
145
146
147
148
149
150
151 @Test
152 public void testGetOutput() {
153 assertEquals("plantuml" + TXT_EXTENSION, PLANTUML_DEPENDENCY_TASK2.getOutput());
154 }
155
156
157
158
159
160
161 @Test
162 public void testGetProgrammingLanguage() {
163 assertEquals(DEFAULT_PROGRAMMING_LANGUAGE.getName(), PLANTUML_DEPENDENCY_TASK2.getProgrammingLanguage());
164 }
165
166
167
168
169
170
171 @Test
172 public void testGetVerboseLevel() {
173 assertEquals(INFO.getName(), PLANTUML_DEPENDENCY_TASK2.getVerboseLevel());
174 }
175
176
177
178
179
180
181 @Test
182 public void testSetBaseDir() {
183 final PlantUMLDependencyProgramTask testTask = new PlantUMLDependencyProgramTask();
184 testTask.setBaseDir(DOT_CHAR);
185 assertEquals(DOT_CHAR, testTask.getBaseDir());
186 }
187
188
189
190
191
192
193 @Test
194 public void testSetDisplayName() {
195 final PlantUMLDependencyProgramTask testTask = new PlantUMLDependencyProgramTask();
196 testTask.setDisplayName(DEFAULT_DISPLAY_NAME_OPTIONS_STRING);
197 assertEquals(DEFAULT_DISPLAY_NAME_OPTIONS_STRING, testTask.getDisplayName());
198 }
199
200
201
202
203
204
205 @Test
206 public void testSetDisplayPackageName() {
207 final PlantUMLDependencyProgramTask testTask = new PlantUMLDependencyProgramTask();
208 testTask.setDisplayPackageName(DEFAULT_DISPLAY_PACKAGE_NAME_OPTIONS_STRING);
209 assertEquals(DEFAULT_DISPLAY_PACKAGE_NAME_OPTIONS_STRING, testTask.getDisplayPackageName());
210 }
211
212
213
214
215
216
217 @Test
218 public void testSetDisplayType() {
219 final PlantUMLDependencyProgramTask testTask = new PlantUMLDependencyProgramTask();
220 testTask.setDisplayType(DEFAULT_DISPLAY_TYPES_OPTIONS_STRING);
221 assertEquals(DEFAULT_DISPLAY_TYPES_OPTIONS_STRING, testTask.getDisplayType());
222 }
223
224
225
226
227
228
229 @Test
230 public void testSetExcludes() {
231 final PlantUMLDependencyProgramTask testTask = new PlantUMLDependencyProgramTask();
232 testTask.setExcludes(DEFAULT_EXCLUDE_OPTIONS);
233 assertEquals(DEFAULT_EXCLUDE_OPTIONS, testTask.getExcludes());
234 }
235
236
237
238
239
240
241 @Test
242 public void testSetIncludes() {
243 final PlantUMLDependencyProgramTask testTask = new PlantUMLDependencyProgramTask();
244 testTask.setIncludes(DEFAULT_INCLUDE_OPTIONS + DEFAULT_PROGRAMMING_LANGUAGE.getName());
245 assertEquals(DEFAULT_INCLUDE_OPTIONS + DEFAULT_PROGRAMMING_LANGUAGE.getName(), testTask.getIncludes());
246 }
247
248
249
250
251
252
253 @Test
254 public void testSetOutput() {
255 final PlantUMLDependencyProgramTask testTask = new PlantUMLDependencyProgramTask();
256 testTask.setOutput("plantuml" + TXT_EXTENSION);
257 assertEquals("plantuml" + TXT_EXTENSION, testTask.getOutput());
258 }
259
260
261
262
263
264
265 @Test
266 public void testSetProgrammingLanguage() {
267 final PlantUMLDependencyProgramTask testTask = new PlantUMLDependencyProgramTask();
268 testTask.setProgrammingLanguage(DEFAULT_PROGRAMMING_LANGUAGE.getName());
269 assertEquals(DEFAULT_PROGRAMMING_LANGUAGE.getName(), testTask.getProgrammingLanguage());
270 }
271
272
273
274
275
276
277 @Test
278 public void testSetVerboseLevel() {
279 final PlantUMLDependencyProgramTask testTask = new PlantUMLDependencyProgramTask();
280 testTask.setVerboseLevel(INFO.getName());
281 assertEquals(INFO.getName(), testTask.getVerboseLevel());
282 }
283
284
285
286
287
288
289 @Test
290 public void testToString() {
291 assertEquals(
292 "PlantUMLDependencyProgramTask [output=plantuml.txt, verboseLevel=INFO, programmingLanguage=java, includes=**/*.java, excludes=**/package-info.java, displayType=abstract_classes,annotations,classes,enums,extensions,implementations,imports,interfaces,native_methods,static_imports, baseDir=., displayName=.*, displayPackageName=.*]",
293 PLANTUML_DEPENDENCY_TASK2.toString());
294 }
295 }