@Test @Transactional public void getApartment() throws Exception { // Initialize the database apartmentRepository.saveAndFlush(apartment); // Get the apartment restApartmentMockMvc .perform(get("/api/apartments/{id}", apartment.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(apartment.getId().intValue())) .andExpect(jsonPath("$.apartmentId").value(DEFAULT_APARTMENT_ID.intValue())) .andExpect(jsonPath("$.created").value(DEFAULT_CREATED_STR)) .andExpect(jsonPath("$.updated").value(DEFAULT_UPDATED_STR)) .andExpect(jsonPath("$.url").value(DEFAULT_URL.toString())); }
@Test @Transactional public void deleteApartment() throws Exception { // Initialize the database apartmentRepository.saveAndFlush(apartment); int databaseSizeBeforeDelete = apartmentRepository.findAll().size(); // Get the apartment restApartmentMockMvc .perform( delete("/api/apartments/{id}", apartment.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Apartment> apartments = apartmentRepository.findAll(); assertThat(apartments).hasSize(databaseSizeBeforeDelete - 1); }