use of com.arnaugarcia.uplace.domain.Photo in project uplace.es by Uplace.
the class PhotoResourceIntTest method updatePhoto.
@Test
@Transactional
public void updatePhoto() throws Exception {
// Initialize the database
photoRepository.saveAndFlush(photo);
int databaseSizeBeforeUpdate = photoRepository.findAll().size();
// Update the photo
Photo updatedPhoto = photoRepository.findOne(photo.getId());
// Disconnect from session so that the updates on updatedPhoto are not directly saved in db
em.detach(updatedPhoto);
updatedPhoto.name(UPDATED_NAME).description(UPDATED_DESCRIPTION).photo(UPDATED_PHOTO).photoContentType(UPDATED_PHOTO_CONTENT_TYPE).thumbnail(UPDATED_THUMBNAIL);
restPhotoMockMvc.perform(put("/api/photos").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedPhoto))).andExpect(status().isOk());
// Validate the Photo in the database
List<Photo> photoList = photoRepository.findAll();
assertThat(photoList).hasSize(databaseSizeBeforeUpdate);
Photo testPhoto = photoList.get(photoList.size() - 1);
assertThat(testPhoto.getName()).isEqualTo(UPDATED_NAME);
assertThat(testPhoto.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
assertThat(testPhoto.getPhoto()).isEqualTo(UPDATED_PHOTO);
assertThat(testPhoto.getPhotoContentType()).isEqualTo(UPDATED_PHOTO_CONTENT_TYPE);
assertThat(testPhoto.isThumbnail()).isEqualTo(UPDATED_THUMBNAIL);
}
use of com.arnaugarcia.uplace.domain.Photo in project uplace.es by Uplace.
the class PhotoResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Photo.class);
Photo photo1 = new Photo();
photo1.setId(1L);
Photo photo2 = new Photo();
photo2.setId(photo1.getId());
assertThat(photo1).isEqualTo(photo2);
photo2.setId(2L);
assertThat(photo1).isNotEqualTo(photo2);
photo1.setId(null);
assertThat(photo1).isNotEqualTo(photo2);
}
use of com.arnaugarcia.uplace.domain.Photo in project uplace.es by Uplace.
the class PhotoResourceIntTest method createPhoto.
@Test
@Transactional
public void createPhoto() throws Exception {
int databaseSizeBeforeCreate = photoRepository.findAll().size();
// Create the Photo
restPhotoMockMvc.perform(post("/api/photos").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(photo))).andExpect(status().isCreated());
// Validate the Photo in the database
List<Photo> photoList = photoRepository.findAll();
assertThat(photoList).hasSize(databaseSizeBeforeCreate + 1);
Photo testPhoto = photoList.get(photoList.size() - 1);
assertThat(testPhoto.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testPhoto.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
assertThat(testPhoto.getPhoto()).isEqualTo(DEFAULT_PHOTO);
assertThat(testPhoto.getPhotoContentType()).isEqualTo(DEFAULT_PHOTO_CONTENT_TYPE);
assertThat(testPhoto.isThumbnail()).isEqualTo(DEFAULT_THUMBNAIL);
}
Aggregations