@Test @Transactional public void createPhysiotherapist() throws Exception { int databaseSizeBeforeCreate = physiotherapistRepository.findAll().size(); // Create the Physiotherapist restPhysiotherapistMockMvc .perform( post("/api/physiotherapists") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(physiotherapist))) .andExpect(status().isCreated()); // Validate the Physiotherapist in the database List<Physiotherapist> physiotherapists = physiotherapistRepository.findAll(); assertThat(physiotherapists).hasSize(databaseSizeBeforeCreate + 1); Physiotherapist testPhysiotherapist = physiotherapists.get(physiotherapists.size() - 1); assertThat(testPhysiotherapist.getFirstName()).isEqualTo(DEFAULT_FIRST_NAME); assertThat(testPhysiotherapist.getLastName()).isEqualTo(DEFAULT_LAST_NAME); assertThat(testPhysiotherapist.getStreet()).isEqualTo(DEFAULT_STREET); assertThat(testPhysiotherapist.getPostalCode()).isEqualTo(DEFAULT_POSTAL_CODE); assertThat(testPhysiotherapist.getCity()).isEqualTo(DEFAULT_CITY); assertThat(testPhysiotherapist.getCountry()).isEqualTo(DEFAULT_COUNTRY); }
@Test @Transactional public void getPhysiotherapist() throws Exception { // Initialize the database physiotherapistRepository.saveAndFlush(physiotherapist); // Get the physiotherapist restPhysiotherapistMockMvc .perform(get("/api/physiotherapists/{id}", physiotherapist.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(physiotherapist.getId().intValue())) .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRST_NAME.toString())) .andExpect(jsonPath("$.lastName").value(DEFAULT_LAST_NAME.toString())) .andExpect(jsonPath("$.street").value(DEFAULT_STREET.toString())) .andExpect(jsonPath("$.postalCode").value(DEFAULT_POSTAL_CODE)) .andExpect(jsonPath("$.city").value(DEFAULT_CITY.toString())) .andExpect(jsonPath("$.country").value(DEFAULT_COUNTRY.toString())); }
@Before public void initTest() { physiotherapist = new Physiotherapist(); physiotherapist.setFirstName(DEFAULT_FIRST_NAME); physiotherapist.setLastName(DEFAULT_LAST_NAME); physiotherapist.setStreet(DEFAULT_STREET); physiotherapist.setPostalCode(DEFAULT_POSTAL_CODE); physiotherapist.setCity(DEFAULT_CITY); physiotherapist.setCountry(DEFAULT_COUNTRY); }
@Test @Transactional public void deletePhysiotherapist() throws Exception { // Initialize the database physiotherapistRepository.saveAndFlush(physiotherapist); int databaseSizeBeforeDelete = physiotherapistRepository.findAll().size(); // Get the physiotherapist restPhysiotherapistMockMvc .perform( delete("/api/physiotherapists/{id}", physiotherapist.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Physiotherapist> physiotherapists = physiotherapistRepository.findAll(); assertThat(physiotherapists).hasSize(databaseSizeBeforeDelete - 1); }
@Test @Transactional public void updatePhysiotherapist() throws Exception { // Initialize the database physiotherapistRepository.saveAndFlush(physiotherapist); int databaseSizeBeforeUpdate = physiotherapistRepository.findAll().size(); // Update the physiotherapist physiotherapist.setFirstName(UPDATED_FIRST_NAME); physiotherapist.setLastName(UPDATED_LAST_NAME); physiotherapist.setStreet(UPDATED_STREET); physiotherapist.setPostalCode(UPDATED_POSTAL_CODE); physiotherapist.setCity(UPDATED_CITY); physiotherapist.setCountry(UPDATED_COUNTRY); restPhysiotherapistMockMvc .perform( put("/api/physiotherapists") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(physiotherapist))) .andExpect(status().isOk()); // Validate the Physiotherapist in the database List<Physiotherapist> physiotherapists = physiotherapistRepository.findAll(); assertThat(physiotherapists).hasSize(databaseSizeBeforeUpdate); Physiotherapist testPhysiotherapist = physiotherapists.get(physiotherapists.size() - 1); assertThat(testPhysiotherapist.getFirstName()).isEqualTo(UPDATED_FIRST_NAME); assertThat(testPhysiotherapist.getLastName()).isEqualTo(UPDATED_LAST_NAME); assertThat(testPhysiotherapist.getStreet()).isEqualTo(UPDATED_STREET); assertThat(testPhysiotherapist.getPostalCode()).isEqualTo(UPDATED_POSTAL_CODE); assertThat(testPhysiotherapist.getCity()).isEqualTo(UPDATED_CITY); assertThat(testPhysiotherapist.getCountry()).isEqualTo(UPDATED_COUNTRY); }