@Test @Transactional public void getHotel() throws Exception { // Initialize the database hotelRepository.saveAndFlush(hotel); // Get the hotel restHotelMockMvc .perform(get("/api/hotels/{id}", hotel.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(hotel.getId().intValue())) .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString())) .andExpect(jsonPath("$.code").value(DEFAULT_CODE)); }
@Test @Transactional public void deleteHotel() throws Exception { // Initialize the database hotelRepository.saveAndFlush(hotel); int databaseSizeBeforeDelete = hotelRepository.findAll().size(); // Get the hotel restHotelMockMvc .perform(delete("/api/hotels/{id}", hotel.getId()).accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Hotel> hotels = hotelRepository.findAll(); assertThat(hotels).hasSize(databaseSizeBeforeDelete - 1); }