@Test @Transactional public void updateApartment() throws Exception { // Initialize the database apartmentRepository.saveAndFlush(apartment); int databaseSizeBeforeUpdate = apartmentRepository.findAll().size(); // Update the apartment apartment.setApartmentId(UPDATED_APARTMENT_ID); apartment.setCreated(UPDATED_CREATED); apartment.setUpdated(UPDATED_UPDATED); apartment.setUrl(UPDATED_URL); restApartmentMockMvc .perform( put("/api/apartments") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(apartment))) .andExpect(status().isOk()); // Validate the Apartment in the database List<Apartment> apartments = apartmentRepository.findAll(); assertThat(apartments).hasSize(databaseSizeBeforeUpdate); Apartment testApartment = apartments.get(apartments.size() - 1); assertThat(testApartment.getApartmentId()).isEqualTo(UPDATED_APARTMENT_ID); assertThat(testApartment.getCreated()).isEqualTo(UPDATED_CREATED); assertThat(testApartment.getUpdated()).isEqualTo(UPDATED_UPDATED); assertThat(testApartment.getUrl()).isEqualTo(UPDATED_URL); }
@Before public void initTest() { apartment = new Apartment(); apartment.setApartmentId(DEFAULT_APARTMENT_ID); apartment.setCreated(DEFAULT_CREATED); apartment.setUpdated(DEFAULT_UPDATED); apartment.setUrl(DEFAULT_URL); }
@Test @Transactional public void checkUpdatedIsRequired() throws Exception { int databaseSizeBeforeTest = apartmentRepository.findAll().size(); // set the field null apartment.setUpdated(null); // Create the Apartment, which fails. restApartmentMockMvc .perform( post("/api/apartments") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(apartment))) .andExpect(status().isBadRequest()); List<Apartment> apartments = apartmentRepository.findAll(); assertThat(apartments).hasSize(databaseSizeBeforeTest); }