1 |
|
package org.europa.together.application; |
2 |
|
|
3 |
|
import static com.google.code.beanmatchers.BeanMatchers.*; |
4 |
|
import java.awt.image.BufferedImage; |
5 |
|
import java.io.File; |
6 |
|
import org.europa.together.JUnit5Preperator; |
7 |
|
import org.europa.together.business.ImageProcessor; |
8 |
|
import org.europa.together.business.Logger; |
9 |
|
import org.europa.together.domain.LogLevel; |
10 |
|
import org.europa.together.utils.Constraints; |
11 |
|
import static org.hamcrest.MatcherAssert.assertThat; |
12 |
|
import org.junit.jupiter.api.AfterAll; |
13 |
|
import org.junit.jupiter.api.AfterEach; |
14 |
|
import static org.junit.jupiter.api.Assertions.*; |
15 |
|
import org.junit.jupiter.api.Assumptions; |
16 |
|
import org.junit.jupiter.api.BeforeAll; |
17 |
|
import org.junit.jupiter.api.BeforeEach; |
18 |
|
import org.junit.jupiter.api.Test; |
19 |
|
import org.junit.jupiter.api.extension.ExtendWith; |
20 |
|
import org.springframework.beans.factory.annotation.Autowired; |
21 |
|
import org.springframework.test.context.ContextConfiguration; |
22 |
|
import org.springframework.test.context.junit.jupiter.SpringExtension; |
23 |
|
|
24 |
|
@SuppressWarnings("unchecked") |
25 |
|
@ExtendWith({JUnit5Preperator.class}) |
26 |
|
@ExtendWith(SpringExtension.class) |
27 |
|
@ContextConfiguration(locations = {"/applicationContext.xml"}) |
|
|
| 94.4% |
Uncovered Elements: 11 (195) |
Complexity: 44 |
Complexity Density: 0.27 |
|
28 |
|
public class ImgSclrProcessorTest { |
29 |
|
|
30 |
|
private static final Logger LOGGER = new LogbackLogger(ImgSclrProcessorTest.class); |
31 |
|
|
32 |
|
private static final String DIRECTORY |
33 |
|
= Constraints.SYSTEM_APP_DIR + "/target/test-classes/org/europa/together/images/"; |
34 |
|
|
35 |
|
@Autowired |
36 |
|
private ImageProcessor processor; |
37 |
|
|
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
39 |
1 |
@BeforeAll... |
40 |
|
static void setUp() { |
41 |
1 |
Assumptions.assumeTrue(true, "Assumtion failed."); |
42 |
|
|
43 |
1 |
LOGGER.log("Assumptions passed ...\n\n", LogLevel.DEBUG); |
44 |
|
} |
45 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
46 |
1 |
@AfterAll... |
47 |
|
static void tearDown() { |
48 |
|
} |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
29 |
@BeforeEach... |
51 |
|
void testCaseInitialization() { |
52 |
29 |
processor.clearImage(); |
53 |
|
} |
54 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
55 |
29 |
@AfterEach... |
56 |
|
void testCaseTermination() { |
57 |
|
} |
58 |
|
|
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
60 |
1 |
@Test... |
61 |
|
void constructor() { |
62 |
1 |
LOGGER.log("TEST CASE: constructor", LogLevel.DEBUG); |
63 |
|
|
64 |
1 |
assertThat(ImgSclrProcessor.class, hasValidBeanConstructor()); |
65 |
|
} |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
67 |
1 |
@Test... |
68 |
|
void loadImageAsFile() { |
69 |
1 |
LOGGER.log("TEST CASE: loadImageAsFile", LogLevel.DEBUG); |
70 |
|
|
71 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
72 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
73 |
|
} |
74 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
75 |
1 |
@Test... |
76 |
|
void loadImageAsBufferedImage() { |
77 |
1 |
LOGGER.log("TEST CASE: loadImageAsBufferedImage", LogLevel.DEBUG); |
78 |
|
|
79 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
80 |
1 |
BufferedImage img = processor.getImage(); |
81 |
1 |
assertNotNull(img); |
82 |
1 |
assertTrue(processor.loadImage(img)); |
83 |
|
} |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
85 |
1 |
@Test... |
86 |
|
void failLoadImage() { |
87 |
1 |
LOGGER.log("TEST CASE: failLoadImage", LogLevel.DEBUG); |
88 |
|
|
89 |
1 |
assertFalse(processor.loadImage(new File(DIRECTORY + "No_Image.gif"))); |
90 |
1 |
BufferedImage img = null; |
91 |
1 |
assertFalse(processor.loadImage(img)); |
92 |
|
} |
93 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
1PASS
|
|
94 |
1 |
@Test... |
95 |
|
void saveImageAsJpg() { |
96 |
1 |
LOGGER.log("TEST CASE: saveImageAsJpg", LogLevel.DEBUG); |
97 |
|
|
98 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
99 |
1 |
BufferedImage img = processor.getImage(); |
100 |
1 |
try { |
101 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_save.jpg"), |
102 |
|
ImageProcessor.FORMAT_JPG)); |
103 |
|
} catch (Exception ex) { |
104 |
0 |
LOGGER.catchException(ex); |
105 |
|
} |
106 |
|
} |
107 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
1PASS
|
|
108 |
1 |
@Test... |
109 |
|
void saveImageAsJpeg() { |
110 |
1 |
LOGGER.log("TEST CASE: saveImageAsJpeg", LogLevel.DEBUG); |
111 |
|
|
112 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
113 |
1 |
BufferedImage img = processor.getImage(); |
114 |
1 |
try { |
115 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_save.jpeg"), |
116 |
|
ImageProcessor.FORMAT_JPEG)); |
117 |
|
} catch (Exception ex) { |
118 |
0 |
LOGGER.catchException(ex); |
119 |
|
} |
120 |
|
} |
121 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
1PASS
|
|
122 |
1 |
@Test... |
123 |
|
void saveImageAsGif() { |
124 |
1 |
LOGGER.log("TEST CASE: saveImageAsGif", LogLevel.DEBUG); |
125 |
|
|
126 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
127 |
1 |
BufferedImage img = processor.getImage(); |
128 |
1 |
try { |
129 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_save.gif"), |
130 |
|
ImageProcessor.FORMAT_GIF)); |
131 |
|
} catch (Exception ex) { |
132 |
0 |
LOGGER.catchException(ex); |
133 |
|
} |
134 |
|
} |
135 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
1PASS
|
|
136 |
1 |
@Test... |
137 |
|
void saveImageAsPng() { |
138 |
1 |
LOGGER.log("TEST CASE: saveImageAsPng", LogLevel.DEBUG); |
139 |
|
|
140 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
141 |
1 |
BufferedImage img = processor.getImage(); |
142 |
1 |
try { |
143 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_save.png"), |
144 |
|
ImageProcessor.FORMAT_PNG)); |
145 |
|
} catch (Exception ex) { |
146 |
0 |
LOGGER.catchException(ex); |
147 |
|
} |
148 |
|
} |
149 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
150 |
1 |
@Test... |
151 |
|
void saveImageWrongType() throws Exception { |
152 |
1 |
LOGGER.log("TEST CASE: saveImageWrongType", LogLevel.DEBUG); |
153 |
|
|
154 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
155 |
1 |
BufferedImage img = processor.getImage(); |
156 |
|
|
157 |
1 |
assertThrows(Exception.class, () -> { |
158 |
1 |
processor.saveImage(img, new File(DIRECTORY + "image_fail_safe.png"), "bpm"); |
159 |
|
}); |
160 |
|
} |
161 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
162 |
1 |
@Test... |
163 |
|
void failSaveImage() throws Exception { |
164 |
1 |
LOGGER.log("TEST CASE: failSaveImage", LogLevel.DEBUG); |
165 |
|
|
166 |
1 |
assertFalse(processor.saveImage(null, null, "jpg")); |
167 |
|
} |
168 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
169 |
1 |
@Test... |
170 |
|
void imageDimensions() { |
171 |
1 |
LOGGER.log("TEST CASE: imageDimensions", LogLevel.DEBUG); |
172 |
|
|
173 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
174 |
1 |
assertEquals(407, processor.getHeight()); |
175 |
1 |
assertEquals(226, processor.getWidth()); |
176 |
|
} |
177 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
178 |
1 |
@Test... |
179 |
|
void calculateImageSize() { |
180 |
1 |
LOGGER.log("TEST CASE: calculateImageSize", LogLevel.DEBUG); |
181 |
|
|
182 |
1 |
assertEquals(0, processor.getImageSize(null)); |
183 |
|
} |
184 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
185 |
1 |
@Test... |
186 |
|
void failCalculateImageSize() { |
187 |
1 |
LOGGER.log("TEST CASE: failCalculateImageSize", LogLevel.DEBUG); |
188 |
|
|
189 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
190 |
1 |
BufferedImage img = processor.getImage(); |
191 |
1 |
assertEquals(367928, processor.getImageSize(img)); |
192 |
|
} |
193 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
194 |
1 |
@Test... |
195 |
|
void reset() { |
196 |
1 |
LOGGER.log("TEST CASE: reset", LogLevel.DEBUG); |
197 |
|
|
198 |
1 |
assertFalse(processor.isImageSet()); |
199 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
200 |
1 |
assertTrue(processor.isImageSet()); |
201 |
1 |
processor.clearImage(); |
202 |
1 |
assertFalse(processor.isImageSet()); |
203 |
|
} |
204 |
|
|
|
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 2 |
Complexity Density: 0.18 |
1PASS
|
|
205 |
1 |
@Test... |
206 |
|
void resizeImageReduce() { |
207 |
1 |
LOGGER.log("TEST CASE: resizeImageReduce", LogLevel.DEBUG); |
208 |
|
|
209 |
1 |
try { |
210 |
1 |
processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png")); |
211 |
1 |
assertTrue(processor.isImageSet()); |
212 |
1 |
BufferedImage img = processor.resize(50); |
213 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_resize_reduce.png"), ImageProcessor.FORMAT_PNG)); |
214 |
|
|
215 |
1 |
processor.clearImage(); |
216 |
1 |
processor.loadImage(new File(DIRECTORY + "image_resize_reduce.png")); |
217 |
1 |
assertEquals(203, processor.getHeight()); |
218 |
1 |
assertEquals(113, processor.getWidth()); |
219 |
|
|
220 |
|
} catch (Exception ex) { |
221 |
0 |
LOGGER.catchException(ex); |
222 |
|
} |
223 |
|
} |
224 |
|
|
|
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 2 |
Complexity Density: 0.18 |
1PASS
|
|
225 |
1 |
@Test... |
226 |
|
void resizeImageNoEffect() { |
227 |
1 |
LOGGER.log("TEST CASE: resizeImageNoEffect", LogLevel.DEBUG); |
228 |
|
|
229 |
1 |
try { |
230 |
1 |
processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png")); |
231 |
1 |
assertTrue(processor.isImageSet()); |
232 |
1 |
BufferedImage img = processor.resize(100); |
233 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_resize_noEffect.png"), ImageProcessor.FORMAT_PNG)); |
234 |
|
|
235 |
1 |
processor.clearImage(); |
236 |
1 |
processor.loadImage(new File(DIRECTORY + "image_resize_noEffect.png")); |
237 |
1 |
assertEquals(407, processor.getHeight()); |
238 |
1 |
assertEquals(226, processor.getWidth()); |
239 |
|
|
240 |
|
} catch (Exception ex) { |
241 |
0 |
LOGGER.catchException(ex); |
242 |
|
} |
243 |
|
} |
244 |
|
|
|
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 2 |
Complexity Density: 0.18 |
1PASS
|
|
245 |
1 |
@Test... |
246 |
|
void resizeImageInflate() { |
247 |
1 |
LOGGER.log("TEST CASE: resizeImageInflate", LogLevel.DEBUG); |
248 |
|
|
249 |
1 |
try { |
250 |
1 |
processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png")); |
251 |
1 |
assertTrue(processor.isImageSet()); |
252 |
1 |
BufferedImage img = processor.resize(150); |
253 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_resize_inflate.png"), ImageProcessor.FORMAT_PNG)); |
254 |
|
|
255 |
1 |
processor.clearImage(); |
256 |
1 |
processor.loadImage(new File(DIRECTORY + "image_resize_inflate.png")); |
257 |
1 |
assertEquals(610, processor.getHeight()); |
258 |
1 |
assertEquals(339, processor.getWidth()); |
259 |
|
|
260 |
|
} catch (Exception ex) { |
261 |
0 |
LOGGER.catchException(ex); |
262 |
|
} |
263 |
|
} |
264 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
265 |
1 |
@Test... |
266 |
|
void failResize() throws Exception { |
267 |
1 |
LOGGER.log("TEST CASE: failResize", LogLevel.DEBUG); |
268 |
|
|
269 |
1 |
assertThrows(Exception.class, () -> { |
270 |
1 |
processor.resize(50); |
271 |
|
}); |
272 |
|
} |
273 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
274 |
1 |
@Test... |
275 |
|
void failResizeImage() throws Exception { |
276 |
1 |
LOGGER.log("TEST CASE: failResizeImage", LogLevel.DEBUG); |
277 |
|
|
278 |
1 |
processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png")); |
279 |
1 |
assertTrue(processor.isImageSet()); |
280 |
|
|
281 |
1 |
assertThrows(Exception.class, () -> { |
282 |
1 |
BufferedImage img = processor.resize(0); |
283 |
|
}); |
284 |
|
} |
285 |
|
|
|
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 2 |
Complexity Density: 0.18 |
1PASS
|
|
286 |
1 |
@Test... |
287 |
|
void imageRotate() { |
288 |
1 |
LOGGER.log("TEST CASE: imageRotate", LogLevel.DEBUG); |
289 |
|
|
290 |
1 |
try { |
291 |
1 |
processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png")); |
292 |
1 |
assertTrue(processor.isImageSet()); |
293 |
1 |
BufferedImage img = processor.rotateRight(); |
294 |
|
|
295 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_rotate.png"), ImageProcessor.FORMAT_PNG)); |
296 |
|
|
297 |
1 |
processor.clearImage(); |
298 |
1 |
processor.loadImage(new File(DIRECTORY + "image_rotate.png")); |
299 |
1 |
assertEquals(226, processor.getHeight()); |
300 |
1 |
assertEquals(407, processor.getWidth()); |
301 |
|
|
302 |
|
} catch (Exception ex) { |
303 |
0 |
LOGGER.catchException(ex); |
304 |
|
} |
305 |
|
} |
306 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
307 |
1 |
@Test... |
308 |
|
void failImageRotate() throws Exception { |
309 |
1 |
LOGGER.log("TEST CASE: failImageRotate", LogLevel.DEBUG); |
310 |
|
|
311 |
1 |
assertThrows(Exception.class, () -> { |
312 |
1 |
processor.rotateRight(); |
313 |
|
}); |
314 |
|
} |
315 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
1PASS
|
|
316 |
1 |
@Test... |
317 |
|
void imageFlipVertical() { |
318 |
1 |
LOGGER.log("TEST CASE: imageFlipVertical", LogLevel.DEBUG); |
319 |
|
|
320 |
1 |
try { |
321 |
1 |
processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png")); |
322 |
1 |
assertTrue(processor.isImageSet()); |
323 |
1 |
BufferedImage img = processor.flipVertical(); |
324 |
|
|
325 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_flip_vertical.png"), ImageProcessor.FORMAT_PNG)); |
326 |
|
|
327 |
|
} catch (Exception ex) { |
328 |
0 |
LOGGER.catchException(ex); |
329 |
|
} |
330 |
|
} |
331 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
332 |
1 |
@Test... |
333 |
|
void failFlipVertical() throws Exception { |
334 |
1 |
LOGGER.log("TEST CASE: failFlipVertical", LogLevel.DEBUG); |
335 |
|
|
336 |
1 |
assertThrows(Exception.class, () -> { |
337 |
1 |
processor.flipVertical(); |
338 |
|
}); |
339 |
|
} |
340 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
1PASS
|
|
341 |
1 |
@Test... |
342 |
|
void imageFlipHorizontal() { |
343 |
1 |
LOGGER.log("TEST CASE: imageFlipHorizontal", LogLevel.DEBUG); |
344 |
|
|
345 |
1 |
try { |
346 |
1 |
processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png")); |
347 |
1 |
assertTrue(processor.isImageSet()); |
348 |
1 |
BufferedImage img = processor.flipHorizontal(); |
349 |
|
|
350 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_flip_horizontal.png"), ImageProcessor.FORMAT_PNG)); |
351 |
|
|
352 |
|
} catch (Exception ex) { |
353 |
0 |
LOGGER.catchException(ex); |
354 |
|
} |
355 |
|
} |
356 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
357 |
1 |
@Test... |
358 |
|
void failFlipHorizontal() throws Exception { |
359 |
1 |
LOGGER.log("TEST CASE: failFlipHorizontal", LogLevel.DEBUG); |
360 |
|
|
361 |
1 |
assertThrows(Exception.class, () -> { |
362 |
1 |
processor.flipHorizontal(); |
363 |
|
}); |
364 |
|
} |
365 |
|
|
|
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 2 |
Complexity Density: 0.18 |
1PASS
|
|
366 |
1 |
@Test... |
367 |
|
void cropImage() { |
368 |
1 |
LOGGER.log("TEST CASE: cropImage", LogLevel.DEBUG); |
369 |
|
|
370 |
1 |
try { |
371 |
1 |
processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png")); |
372 |
1 |
assertTrue(processor.isImageSet()); |
373 |
1 |
BufferedImage img = processor.crop(30, 50, 150, 100); |
374 |
|
|
375 |
1 |
assertTrue(processor.saveImage(img, new File(DIRECTORY + "image_cropped.png"), ImageProcessor.FORMAT_PNG)); |
376 |
|
|
377 |
1 |
processor.clearImage(); |
378 |
1 |
processor.loadImage(new File(DIRECTORY + "image_cropped.png")); |
379 |
1 |
assertEquals(150, processor.getHeight()); |
380 |
1 |
assertEquals(100, processor.getWidth()); |
381 |
|
} catch (Exception ex) { |
382 |
0 |
LOGGER.catchException(ex); |
383 |
|
} |
384 |
|
|
385 |
|
} |
386 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
387 |
1 |
@Test... |
388 |
|
void failCropImage() throws Exception { |
389 |
1 |
LOGGER.log("TEST CASE: failCropImage", LogLevel.DEBUG); |
390 |
|
|
391 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
392 |
1 |
assertThrows(Exception.class, () -> { |
393 |
1 |
processor.crop(0, 0, 0, 0); |
394 |
|
}); |
395 |
|
} |
396 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
397 |
1 |
@Test... |
398 |
|
void generateToString() { |
399 |
1 |
LOGGER.log("TEST CASE: generateToString", LogLevel.DEBUG); |
400 |
|
|
401 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "135621.jpg"))); |
402 |
1 |
LOGGER.log("toString: " + processor.toString(), LogLevel.DEBUG); |
403 |
1 |
assertNotEquals("No meta data from 135621.jpg extracted.", processor.toString()); |
404 |
|
} |
405 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
406 |
1 |
@Test... |
407 |
|
void generateToStringWhitoutMetaData() { |
408 |
1 |
LOGGER.log("TEST CASE: generateToStringWhitoutMetaData", LogLevel.DEBUG); |
409 |
|
|
410 |
1 |
assertTrue(processor.loadImage(new File(DIRECTORY + "duke_java_mascot.png"))); |
411 |
1 |
LOGGER.log("toString: " + processor.toString(), LogLevel.DEBUG); |
412 |
1 |
assertEquals("No meta data from duke_java_mascot.png extracted.", processor.toString()); |
413 |
|
} |
414 |
|
} |