2121import com .sksamuel .scrimage .ImmutableImage ;
2222import org .junit .jupiter .api .DisplayName ;
2323import org .junit .jupiter .api .Nested ;
24+ import org .junit .jupiter .api .Tag ;
2425import org .junit .jupiter .api .Test ;
2526import org .junit .jupiter .api .condition .EnabledIfEnvironmentVariable ;
2627import ws .schild .jave .EncoderException ;
3738class MediaHelperTest {
3839
3940 @ Test
41+ @ Tag ("Image" )
4042 void resizeRectangularImage () throws Exception {
4143 var jpgImage = loadResource ("big.jpg" );
4244 var result = MediaHelper .convert (jpgImage );
@@ -61,6 +63,7 @@ private static String getExtension(File file) {
6163 }
6264
6365 @ Test
66+ @ Tag ("Image" )
6467 void resizeSmallImage () throws Exception {
6568 var pngImage = loadResource ("small_image.png" );
6669 var result = MediaHelper .convert (pngImage );
@@ -69,6 +72,7 @@ void resizeSmallImage() throws Exception {
6972 }
7073
7174 @ Test
75+ @ Tag ("Image" )
7276 void noImageConversionNeeded () throws Exception {
7377 var pngImage = loadResource ("valid.png" );
7478 var result = MediaHelper .convert (pngImage );
@@ -77,6 +81,7 @@ void noImageConversionNeeded() throws Exception {
7781 }
7882
7983 @ Test
84+ @ Tag ("Image" )
8085 void resizeStaticWebpImage () throws Exception {
8186 var webpImage = loadResource ("static.webp" );
8287 var result = MediaHelper .convert (webpImage );
@@ -85,13 +90,15 @@ void resizeStaticWebpImage() throws Exception {
8590 }
8691
8792 @ Test
93+ @ Tag ("Video" )
8894 void resizeAnimatedWebpImage () {
89- var webpImage = loadResource ("animated.webp" );
95+ var webpAnimation = loadResource ("animated.webp" );
9096
91- assertThrows (MediaException .class , () -> MediaHelper .convert (webpImage ));
97+ assertThrows (MediaException .class , () -> MediaHelper .convert (webpAnimation ));
9298 }
9399
94100 @ Test
101+ @ Tag ("Image" )
95102 void resizeFaviconImage () throws Exception {
96103 var faviconImage = loadResource ("favicon.ico" );
97104 var result = MediaHelper .convert (faviconImage );
@@ -100,6 +107,7 @@ void resizeFaviconImage() throws Exception {
100107 }
101108
102109 @ Test
110+ @ Tag ("Image" )
103111 void resizeTiffImage () throws Exception {
104112 var tiffImage = loadResource ("valid.tiff" );
105113 var result = MediaHelper .convert (tiffImage );
@@ -108,6 +116,7 @@ void resizeTiffImage() throws Exception {
108116 }
109117
110118 @ Test
119+ @ Tag ("Image" )
111120 void resizePsdImage () throws Exception {
112121 var psdImage = loadResource ("valid.psd" );
113122 var result = MediaHelper .convert (psdImage );
@@ -116,6 +125,7 @@ void resizePsdImage() throws Exception {
116125 }
117126
118127 @ Test
128+ @ Tag ("Image" )
119129 void resizeDetailedImage () throws Exception {
120130 var detailedImage = loadResource ("detailed.jpg" );
121131 var result = MediaHelper .convert (detailedImage );
@@ -124,6 +134,7 @@ void resizeDetailedImage() throws Exception {
124134 }
125135
126136 @ Test
137+ @ Tag ("Image" )
127138 void resizeSvgImage () throws Exception {
128139 var svgImage = loadResource ("valid.svg" );
129140 var result = MediaHelper .convert (svgImage );
@@ -132,6 +143,7 @@ void resizeSvgImage() throws Exception {
132143 }
133144
134145 @ Test
146+ @ Tag ("Video" )
135147 void convertLongMovVideo () throws Exception {
136148 var movVideo = loadResource ("long.mov" );
137149 var result = MediaHelper .convert (movVideo );
@@ -160,6 +172,7 @@ private static void assertVideoConsistency(File result, int expectedWidth, int e
160172 }
161173
162174 @ Test
175+ @ Tag ("Video" )
163176 void convertMp4WithAudio () throws Exception {
164177 var mp4Video = loadResource ("video_with_audio.mp4" );
165178 var result = MediaHelper .convert (mp4Video );
@@ -168,6 +181,7 @@ void convertMp4WithAudio() throws Exception {
168181 }
169182
170183 @ Test
184+ @ Tag ("Video" )
171185 void convertM4vWithAudio () throws Exception {
172186 var m4vVideo = loadResource ("video_with_audio.m4v" );
173187 var result = MediaHelper .convert (m4vVideo );
@@ -176,6 +190,7 @@ void convertM4vWithAudio() throws Exception {
176190 }
177191
178192 @ Test
193+ @ Tag ("Video" )
179194 void convertShortAndLowFpsVideo () throws Exception {
180195 var webmVideo = loadResource ("short_low_fps.webm" );
181196 var result = MediaHelper .convert (webmVideo );
@@ -184,6 +199,7 @@ void convertShortAndLowFpsVideo() throws Exception {
184199 }
185200
186201 @ Test
202+ @ Tag ("Video" )
187203 void resizeSmallWebmVideo () throws Exception {
188204 var webmVideo = loadResource ("small_video_sticker.webm" );
189205 var result = MediaHelper .convert (webmVideo );
@@ -192,6 +208,7 @@ void resizeSmallWebmVideo() throws Exception {
192208 }
193209
194210 @ Test
211+ @ Tag ("Video" )
195212 void convertVerticalWebmVideo () throws Exception {
196213 var webmVideo = loadResource ("vertical_video_sticker.webm" );
197214 var result = MediaHelper .convert (webmVideo );
@@ -200,6 +217,7 @@ void convertVerticalWebmVideo() throws Exception {
200217 }
201218
202219 @ Test
220+ @ Tag ("Video" )
203221 void convertGifVideo () throws Exception {
204222 var gifVideo = loadResource ("valid.gif" );
205223 var result = MediaHelper .convert (gifVideo );
@@ -208,6 +226,7 @@ void convertGifVideo() throws Exception {
208226 }
209227
210228 @ Test
229+ @ Tag ("Video" )
211230 void convertAviVideo () throws Exception {
212231 var aviVideo = loadResource ("valid.avi" );
213232 var result = MediaHelper .convert (aviVideo );
@@ -216,6 +235,7 @@ void convertAviVideo() throws Exception {
216235 }
217236
218237 @ Test
238+ @ Tag ("Video" )
219239 void noVideoConversionNeeded () throws Exception {
220240 var webmVideo = loadResource ("no_conversion_needed.webm" );
221241 var result = MediaHelper .convert (webmVideo );
@@ -224,6 +244,7 @@ void noVideoConversionNeeded() throws Exception {
224244 }
225245
226246 @ Test
247+ @ Tag ("AnimatedSticker" )
227248 void noAnimatedStickerConversionNeeded () throws Exception {
228249 var animatedSticker = loadResource ("animated_sticker.tgs" );
229250 var result = MediaHelper .convert (animatedSticker );
@@ -232,6 +253,7 @@ void noAnimatedStickerConversionNeeded() throws Exception {
232253 }
233254
234255 @ Test
256+ @ Tag ("AnimatedSticker" )
235257 void noLowFpsAnimatedStickerConversionNeeded () throws Exception {
236258 var animatedSticker = loadResource ("low_fps_animated_sticker.tgs" );
237259 var result = MediaHelper .convert (animatedSticker );
@@ -240,20 +262,23 @@ void noLowFpsAnimatedStickerConversionNeeded() throws Exception {
240262 }
241263
242264 @ Test
265+ @ Tag ("AnimatedSticker" )
243266 void nonCompliantAnimatedSticker () {
244267 var animatedSticker = loadResource ("non_compliant_animated_sticker.tgs" );
245268
246269 assertThrows (MediaException .class , () -> MediaHelper .convert (animatedSticker ));
247270 }
248271
249272 @ Test
273+ @ Tag ("AnimatedSticker" )
250274 void unsupportedGzipArchive () {
251275 var archive = loadResource ("unsupported_archive.gz" );
252276
253277 assertThrows (MediaException .class , () -> MediaHelper .convert (archive ));
254278 }
255279
256280 @ Test
281+ @ Tag ("UnsupportedFile" )
257282 void unsupportedFile () {
258283 var document = loadResource ("document.txt" );
259284
@@ -266,6 +291,7 @@ void unsupportedFile() {
266291 class ConcurrencyTest {
267292
268293 @ Test
294+ @ Tag ("Video" )
269295 @ DisplayName ("mov videos" )
270296 void concurrentMovVideoConversions () {
271297 var movVideo = loadResource ("long.mov" );
@@ -296,6 +322,7 @@ private static void executeConcurrentConversionsOf(File inputFile) {
296322 }
297323
298324 @ Test
325+ @ Tag ("Video" )
299326 @ DisplayName ("mp4 videos" )
300327 void concurrentMp4VideoConversions () {
301328 var mp4Video = loadResource ("video_with_audio.mp4" );
@@ -304,6 +331,7 @@ void concurrentMp4VideoConversions() {
304331 }
305332
306333 @ Test
334+ @ Tag ("Video" )
307335 @ DisplayName ("m4v videos" )
308336 void concurrentM4vVideoConversions () {
309337 var m4vVideo = loadResource ("video_with_audio.m4v" );
@@ -312,6 +340,7 @@ void concurrentM4vVideoConversions() {
312340 }
313341
314342 @ Test
343+ @ Tag ("Video" )
315344 @ DisplayName ("webm videos" )
316345 void concurrentWebmVideoConversions () {
317346 var webmVideo = loadResource ("small_video_sticker.webm" );
@@ -320,6 +349,7 @@ void concurrentWebmVideoConversions() {
320349 }
321350
322351 @ Test
352+ @ Tag ("Video" )
323353 @ DisplayName ("avi videos" )
324354 void concurrentAviVideoConversions () {
325355 var aviVideo = loadResource ("valid.avi" );
@@ -328,6 +358,7 @@ void concurrentAviVideoConversions() {
328358 }
329359
330360 @ Test
361+ @ Tag ("Video" )
331362 @ DisplayName ("gif videos" )
332363 void concurrentGifVideoConversions () {
333364 var gifVideo = loadResource ("valid.gif" );
@@ -336,6 +367,7 @@ void concurrentGifVideoConversions() {
336367 }
337368
338369 @ Test
370+ @ Tag ("Image" )
339371 @ DisplayName ("webp images" )
340372 void concurrentWebpImageConversions () {
341373 var webpImage = loadResource ("static.webp" );
@@ -344,6 +376,7 @@ void concurrentWebpImageConversions() {
344376 }
345377
346378 @ Test
379+ @ Tag ("Image" )
347380 @ DisplayName ("jpg images" )
348381 void concurrentJpgImageConversions () {
349382 var jpgImage = loadResource ("big.jpg" );
@@ -352,6 +385,7 @@ void concurrentJpgImageConversions() {
352385 }
353386
354387 @ Test
388+ @ Tag ("Image" )
355389 @ DisplayName ("png images" )
356390 void concurrentPngImageConversions () {
357391 var pngImage = loadResource ("big.png" );
@@ -360,6 +394,7 @@ void concurrentPngImageConversions() {
360394 }
361395
362396 @ Test
397+ @ Tag ("Image" )
363398 @ DisplayName ("ico images" )
364399 void concurrentFaviconImageConversions () {
365400 var faviconImage = loadResource ("favicon.ico" );
@@ -368,6 +403,7 @@ void concurrentFaviconImageConversions() {
368403 }
369404
370405 @ Test
406+ @ Tag ("Image" )
371407 @ DisplayName ("tiff images" )
372408 void concurrentTiffImageConversions () {
373409 var tiffImage = loadResource ("valid.tiff" );
@@ -376,6 +412,7 @@ void concurrentTiffImageConversions() {
376412 }
377413
378414 @ Test
415+ @ Tag ("Image" )
379416 @ DisplayName ("psd images" )
380417 void concurrentPsdImageConversions () {
381418 var psdImage = loadResource ("valid.psd" );
@@ -384,6 +421,7 @@ void concurrentPsdImageConversions() {
384421 }
385422
386423 @ Test
424+ @ Tag ("Image" )
387425 @ DisplayName ("svg images" )
388426 void concurrentSvgImageConversions () {
389427 var psdImage = loadResource ("valid.svg" );
0 commit comments