@Test @Transactional public void updateHotel() throws Exception { // Initialize the database hotelRepository.saveAndFlush(hotel); int databaseSizeBeforeUpdate = hotelRepository.findAll().size(); // Update the hotel hotel.setName(UPDATED_NAME); hotel.setCode(UPDATED_CODE); restHotelMockMvc .perform( put("/api/hotels") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(hotel))) .andExpect(status().isOk()); // Validate the Hotel in the database List<Hotel> hotels = hotelRepository.findAll(); assertThat(hotels).hasSize(databaseSizeBeforeUpdate); Hotel testHotel = hotels.get(hotels.size() - 1); assertThat(testHotel.getName()).isEqualTo(UPDATED_NAME); assertThat(testHotel.getCode()).isEqualTo(UPDATED_CODE); }
@Before public void initTest() { hotel = new Hotel(); hotel.setName(DEFAULT_NAME); hotel.setCode(DEFAULT_CODE); }