private Response createWishlistMedia() throws FileNotFoundException {
    InputStream is = new FileInputStream(TEST_FILE_FOR_UPLOAD);

    URI requestUri = URI.create(REQUEST_URI + "/" + wishlist.getId() + "/media");

    return cut.postByWishlistIdMedia(yaasAware, wishlist.getId(), is, requestUri);
  }
  /* post(entity) /wishlists */
  @Test
  public void testPostWithWishlist() {
    Wishlist wishlist = new Wishlist();
    wishlist.setId(UUID.randomUUID().toString());
    wishlist.setOwner(TestConstants.CUSTOMER);
    instanceList.add(wishlist.getId());

    final Response response = createWishlist(wishlist);

    Assert.assertNotNull("Response must not be null", response);
    Assert.assertEquals(
        "Response does not have expected response code",
        Status.CREATED.getStatusCode(),
        response.getStatus());
  }
  @Before
  public void before() {
    this.yaasAware = new YaasAwareParameters();
    this.yaasAware.setHybrisClient(CLIENT);
    this.yaasAware.setHybrisTenant(TestConstants.TENANT);

    wishlist = new Wishlist();
    wishlist.setId(UUID.randomUUID().toString());
    wishlist.setDescription("Test");
    wishlist.setOwner(TestConstants.CUSTOMER);

    instanceList.add(wishlist.getId());

    createWishlist(wishlist);
  }
  /* post(entity) /wishlists */
  @Test
  public void testPostWithInvalidWishlistOwner() {
    Wishlist wishlist = new Wishlist();
    wishlist.setId(UUID.randomUUID().toString());
    wishlist.setOwner("Test");
    instanceList.add(wishlist.getId());

    final Response response = createWishlist(wishlist);

    Assert.assertNotNull("Response must not be null", response);
    Assert.assertEquals(
        "Should return bad request when wishlist owner does not exist",
        Status.BAD_REQUEST.getStatusCode(),
        response.getStatus());
  }
  /* post(entity) /wishlists */
  @Test
  public void testPostCheckDuplicateID() {
    Wishlist wishlist = new Wishlist();
    wishlist.setId(UUID.randomUUID().toString());
    wishlist.setOwner(TestConstants.CUSTOMER);
    instanceList.add(wishlist.getId());
    createWishlist(wishlist);

    final Response response = createWishlist(wishlist);

    Assert.assertNotNull("Response must not be null", response);
    Assert.assertEquals(
        "Should return conflict when wishlist id is already used",
        Status.CONFLICT.getStatusCode(),
        response.getStatus());
  }
  @After
  public void after() {
    for (String instance : instanceListMedia) {
      deleteWishlistMedia(wishlist.getId(), instance);
    }

    for (String instance : instanceList) {
      deleteWishlist(instance);
    }
  }
  /* delete() /wishlists/wishlistId */
  @Test
  public void testDeleteByWishlistId() {
    final Response response = deleteWishlist(wishlist.getId());

    Assert.assertNotNull("Response must not be null", response);
    Assert.assertEquals(
        "Response does not have expected response code",
        Status.NO_CONTENT.getStatusCode(),
        response.getStatus());
  }
  /* delete() /wishlists/wishlistId/media/mediaId */
  @Test
  public void testDeleteByWishlistIdMediaByMediaId() throws FileNotFoundException {
    Response response = createWishlistMedia();
    String location =
        response
            .getHeaderString("location")
            .substring(response.getHeaderString("location").lastIndexOf("/") + 1);

    final Response responseDelete = deleteWishlistMedia(wishlist.getId(), location);

    Assert.assertNotNull("Response must not be null", responseDelete);
    Assert.assertEquals(
        "Response does not have expected response code",
        Status.NO_CONTENT.getStatusCode(),
        responseDelete.getStatus());
  }
  /* get() /wishlists/wishlistId */
  @Test
  public void testGetByWishlistId() {
    final WebTarget target = getRootTarget(ROOT_RESOURCE_PATH).path("/" + wishlist.getId());

    final Response response =
        target
            .request()
            .header(YaasAwareTrait.Headers.CLIENT, CLIENT)
            .header(YaasAwareTrait.Headers.TENANT, TestConstants.TENANT)
            .get();

    Assert.assertNotNull("Response must not be null", response);
    Assert.assertEquals(
        "Response does not have expected response code",
        Status.OK.getStatusCode(),
        response.getStatus());
  }
  /* put(entity) /wishlists/wishlistId */
  @Test
  public void testPutByWishlistIdWithWishlist() {
    final WebTarget target = getRootTarget(ROOT_RESOURCE_PATH).path("/" + wishlist.getId());
    final Wishlist entityBody = wishlist;
    final Entity<Wishlist> entity = Entity.entity(entityBody, "application/json");

    final Response response =
        target
            .request()
            .header(YaasAwareTrait.Headers.CLIENT, CLIENT)
            .header(YaasAwareTrait.Headers.TENANT, TestConstants.TENANT)
            .put(entity);

    Assert.assertNotNull("Response must not be null", response);
    Assert.assertEquals(
        "Response does not have expected response code",
        Status.OK.getStatusCode(),
        response.getStatus());
  }
  /* get() /wishlists/wishlistId/media */
  @Test
  public void testGetByWishlistIdMedia()
      throws MalformedURLException, NoSuchAlgorithmException, IOException {
    Response response = createWishlistMedia();
    String location =
        response
            .getHeaderString("location")
            .substring(response.getHeaderString("location").lastIndexOf("/") + 1);
    instanceListMedia.add(location);

    final WebTarget target =
        getRootTarget(ROOT_RESOURCE_PATH).path("/" + wishlist.getId() + "/media");
    final Response responseGet =
        target
            .request()
            .header(YaasAwareTrait.Headers.CLIENT, CLIENT)
            .header(YaasAwareTrait.Headers.TENANT, TestConstants.TENANT)
            .get();

    Assert.assertNotNull("Response must not be null", responseGet);
    Assert.assertEquals(
        "Response does not have expected response code",
        Status.OK.getStatusCode(),
        responseGet.getStatus());

    WishlistMedia[] wishlistMedias = responseGet.readEntity(WishlistMedia[].class);
    String actMD5 = null;
    for (WishlistMedia wishlistMedia : wishlistMedias) {
      if (location.equals(wishlistMedia.getId())) {
        actMD5 = computeMD5ChecksumForURL(new URL(wishlistMedia.getUri().toString()));
      }
    }

    String expMD5 = computeMD5ChecksumForFile(TEST_FILE_FOR_UPLOAD);
    Assert.assertEquals("File on media repository is different from file sent", expMD5, actMD5);
  }