Skip to content

Commit 24e414e

Browse files
committed
Tag media helper tests by tested flow
1 parent c0e6f82 commit 24e414e

File tree

1 file changed

+45
-7
lines changed

1 file changed

+45
-7
lines changed

src/test/java/com/github/stickerifier/stickerify/media/MediaHelperTest.java

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.sksamuel.scrimage.ImmutableImage;
2222
import org.junit.jupiter.api.DisplayName;
2323
import org.junit.jupiter.api.Nested;
24+
import org.junit.jupiter.api.Tag;
2425
import org.junit.jupiter.api.Test;
2526
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
2627
import ws.schild.jave.EncoderException;
@@ -37,6 +38,7 @@
3738
class 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,7 @@ void resizeStaticWebpImage() throws Exception {
8590
}
8691

8792
@Test
88-
void resizeAnimatedWebpImage() {
89-
var webpImage = loadResource("animated.webp");
90-
91-
assertThrows(MediaException.class, () -> MediaHelper.convert(webpImage));
92-
}
93-
94-
@Test
93+
@Tag("Image")
9594
void resizeFaviconImage() throws Exception {
9695
var faviconImage = loadResource("favicon.ico");
9796
var result = MediaHelper.convert(faviconImage);
@@ -100,6 +99,7 @@ void resizeFaviconImage() throws Exception {
10099
}
101100

102101
@Test
102+
@Tag("Image")
103103
void resizeTiffImage() throws Exception {
104104
var tiffImage = loadResource("valid.tiff");
105105
var result = MediaHelper.convert(tiffImage);
@@ -108,6 +108,7 @@ void resizeTiffImage() throws Exception {
108108
}
109109

110110
@Test
111+
@Tag("Image")
111112
void resizePsdImage() throws Exception {
112113
var psdImage = loadResource("valid.psd");
113114
var result = MediaHelper.convert(psdImage);
@@ -116,6 +117,7 @@ void resizePsdImage() throws Exception {
116117
}
117118

118119
@Test
120+
@Tag("Image")
119121
void resizeDetailedImage() throws Exception {
120122
var detailedImage = loadResource("detailed.jpg");
121123
var result = MediaHelper.convert(detailedImage);
@@ -124,6 +126,7 @@ void resizeDetailedImage() throws Exception {
124126
}
125127

126128
@Test
129+
@Tag("Image")
127130
void resizeSvgImage() throws Exception {
128131
var svgImage = loadResource("valid.svg");
129132
var result = MediaHelper.convert(svgImage);
@@ -132,6 +135,7 @@ void resizeSvgImage() throws Exception {
132135
}
133136

134137
@Test
138+
@Tag("Video")
135139
void convertLongMovVideo() throws Exception {
136140
var movVideo = loadResource("long.mov");
137141
var result = MediaHelper.convert(movVideo);
@@ -160,6 +164,7 @@ private static void assertVideoConsistency(File result, int expectedWidth, int e
160164
}
161165

162166
@Test
167+
@Tag("Video")
163168
void convertMp4WithAudio() throws Exception {
164169
var mp4Video = loadResource("video_with_audio.mp4");
165170
var result = MediaHelper.convert(mp4Video);
@@ -168,6 +173,7 @@ void convertMp4WithAudio() throws Exception {
168173
}
169174

170175
@Test
176+
@Tag("Video")
171177
void convertM4vWithAudio() throws Exception {
172178
var m4vVideo = loadResource("video_with_audio.m4v");
173179
var result = MediaHelper.convert(m4vVideo);
@@ -176,6 +182,7 @@ void convertM4vWithAudio() throws Exception {
176182
}
177183

178184
@Test
185+
@Tag("Video")
179186
void convertShortAndLowFpsVideo() throws Exception {
180187
var webmVideo = loadResource("short_low_fps.webm");
181188
var result = MediaHelper.convert(webmVideo);
@@ -184,6 +191,7 @@ void convertShortAndLowFpsVideo() throws Exception {
184191
}
185192

186193
@Test
194+
@Tag("Video")
187195
void resizeSmallWebmVideo() throws Exception {
188196
var webmVideo = loadResource("small_video_sticker.webm");
189197
var result = MediaHelper.convert(webmVideo);
@@ -192,6 +200,7 @@ void resizeSmallWebmVideo() throws Exception {
192200
}
193201

194202
@Test
203+
@Tag("Video")
195204
void convertVerticalWebmVideo() throws Exception {
196205
var webmVideo = loadResource("vertical_video_sticker.webm");
197206
var result = MediaHelper.convert(webmVideo);
@@ -200,6 +209,7 @@ void convertVerticalWebmVideo() throws Exception {
200209
}
201210

202211
@Test
212+
@Tag("Video")
203213
void convertGifVideo() throws Exception {
204214
var gifVideo = loadResource("valid.gif");
205215
var result = MediaHelper.convert(gifVideo);
@@ -208,6 +218,7 @@ void convertGifVideo() throws Exception {
208218
}
209219

210220
@Test
221+
@Tag("Video")
211222
void convertAviVideo() throws Exception {
212223
var aviVideo = loadResource("valid.avi");
213224
var result = MediaHelper.convert(aviVideo);
@@ -216,6 +227,7 @@ void convertAviVideo() throws Exception {
216227
}
217228

218229
@Test
230+
@Tag("Video")
219231
void noVideoConversionNeeded() throws Exception {
220232
var webmVideo = loadResource("no_conversion_needed.webm");
221233
var result = MediaHelper.convert(webmVideo);
@@ -224,6 +236,15 @@ void noVideoConversionNeeded() throws Exception {
224236
}
225237

226238
@Test
239+
@Tag("Video")
240+
void resizeAnimatedWebpVideo() {
241+
var webpVideo = loadResource("animated.webp");
242+
243+
assertThrows(MediaException.class, () -> MediaHelper.convert(webpVideo));
244+
}
245+
246+
@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

Comments
 (0)