@Test
  public void updatePicture() throws Exception {
    // Initialize the database
    pictureRepository.save(picture);

    int databaseSizeBeforeUpdate = pictureRepository.findAll().size();

    // Update the picture
    picture.setTitle(UPDATED_TITLE);
    picture.setDescription(UPDATED_DESCRIPTION);
    picture.setPictureFile(ByteBuffer.wrap(UPDATED_PICTURE_FILE));

    picture.setCreated(UPDATED_CREATED);
    picture.setModified(UPDATED_MODIFIED);

    PictureDTO pictureDTO = pictureMapper.pictureToPictureDTO(picture);

    restPictureMockMvc
        .perform(
            put("/api/pictures")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(pictureDTO)))
        .andExpect(status().isOk());

    // Validate the Picture in the database
    List<Picture> pictures = pictureRepository.findAll();
    assertThat(pictures).hasSize(databaseSizeBeforeUpdate);
    Picture testPicture = pictures.get(pictures.size() - 1);
    assertThat(testPicture.getTitle()).isEqualTo(UPDATED_TITLE);
    assertThat(testPicture.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
    assertThat(testPicture.getPictureFile()).isEqualTo(UPDATED_PICTURE_FILE);

    assertThat(testPicture.getCreated()).isEqualTo(UPDATED_CREATED);
    assertThat(testPicture.getModified()).isEqualTo(UPDATED_MODIFIED);
  }
  @Before
  public void initTest() {
    pictureRepository.deleteAll();
    picture = new Picture();
    picture.setTitle(DEFAULT_TITLE);
    picture.setDescription(DEFAULT_DESCRIPTION);
    picture.setPictureFile(ByteBuffer.wrap(DEFAULT_PICTURE_FILE));

    picture.setCreated(DEFAULT_CREATED);
    picture.setModified(DEFAULT_MODIFIED);
  }