@Test
 public void testMedia() throws Exception {
   processFile(productId, "base_product-", new ProductContent());
   final ProductModel product =
       processFile(
           productId,
           "media-",
           new FileContent() {
             @Override
             public void writeContent(final PrintWriter writer) throws IOException {
               writer.println("test.jpg");
             }
           });
   verifyMedia(product.getPicture(), "300Wx300H");
   verifyMedia(product.getThumbnail(), "96Wx96H");
   verifyMedia(product.getThumbnails().iterator().next(), "96Wx96H");
   verifyMedia(product.getDetail().iterator().next(), "1200Wx1200H");
   for (final MediaModel media : product.getOthers()) {
     if ("515Wx515H".equals(media.getMediaFormat().getQualifier())) {
       verifyMedia(media, "515Wx515H");
     } else if ("96Wx96H".equals(media.getMediaFormat().getQualifier())) {
       verifyMedia(media, "96Wx96H");
     } else {
       verifyMedia(media, "30Wx30H");
     }
   }
   verifyMedia(product.getNormal().iterator().next(), "300Wx300H");
   final MediaContainerModel container = product.getGalleryImages().iterator().next();
   final Set<String> formats = new HashSet<String>();
   formats.add("30Wx30H");
   formats.add("65Wx65H");
   formats.add("96Wx96H");
   formats.add("300Wx300H");
   formats.add("515Wx515H");
   formats.add("1200Wx1200H");
   final Set<String> containerFormats = new HashSet<String>();
   for (final MediaModel media : container.getMedias()) {
     containerFormats.add(media.getMediaFormat().getQualifier());
   }
   Assert.assertEquals(formats, containerFormats);
   Assert.assertEquals("Staged", container.getCatalogVersion().getVersion());
   Assert.assertEquals(
       "apparelProductCatalog", container.getCatalogVersion().getCatalog().getId());
 }
 /**
  * Populating images for container
  *
  * @param source
  * @param target
  */
 protected void populateImages(
     final MediaContainerModel source,
     final List<ImageData> target,
     final ImageDataType imageType) {
   if (source != null) {
     final Collection<MediaModel> mediaModels = source.getMedias();
     if (CollectionUtils.isNotEmpty(mediaModels)) {
       for (final MediaModel media : mediaModels) {
         if (media != null) {
           final ImageData imageData = getImageConverter().convert(media);
           imageData.setImageType(imageType);
           target.add(imageData);
         }
       }
       sortMediasBasedOnWidth(target);
     } else {
       LOG.info("No medias found for this media container.");
     }
   }
 }