From 515847285299c69d0d56be23a9c71e0197b284ec Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Mon, 1 Aug 2022 21:17:09 +0200 Subject: [PATCH] Apply changes in DefaultTests and add utility method to test image lists This new method, defaultTestImageList(List thumbnails = item.getThumbnails(); + if (!isNullOrEmpty(thumbnails)) { + defaultTestImageCollection(thumbnails); } assertNotNull(item.getInfoType(), "InfoItem type not set: " + item); assertEquals(expectedService.getServiceId(), item.getServiceId(), "Unexpected item service id"); @@ -44,9 +55,9 @@ public final class DefaultTests { assertExpectedLinkType(expectedService, uploaderUrl, LinkType.CHANNEL); } - final String uploaderAvatarUrl = streamInfoItem.getUploaderAvatarUrl(); - if (!isNullOrEmpty(uploaderAvatarUrl)) { - assertIsSecureUrl(uploaderAvatarUrl); + final List uploaderAvatars = streamInfoItem.getUploaderAvatars(); + if (!isNullOrEmpty(uploaderAvatars)) { + defaultTestImageCollection(uploaderAvatars); } assertExpectedLinkType(expectedService, streamInfoItem.getUrl(), LinkType.STREAM); @@ -134,4 +145,16 @@ public final class DefaultTests { final ListExtractor.InfoItemsPage page = newExtractor.getPage(nextPage); defaultTestListOfItems(extractor.getService(), page.getItems(), page.getErrors()); } + + public static void defaultTestImageCollection( + @Nullable final Collection imageCollection) { + assertNotNull(imageCollection); + imageCollection.forEach(image -> { + assertIsSecureUrl(image.getUrl()); + assertGreaterOrEqual(Image.HEIGHT_UNKNOWN, image.getHeight(), + "Unexpected image height: " + image.getHeight()); + assertGreaterOrEqual(Image.WIDTH_UNKNOWN, image.getWidth(), + "Unexpected image width: " + image.getWidth()); + }); + } }