@Test @Transactional public void updateStudent() throws Exception { // Initialize the database studentRepository.saveAndFlush(student); int databaseSizeBeforeUpdate = studentRepository.findAll().size(); // Update the student student.setSid(UPDATED_SID); student.setLastName(UPDATED_LAST_NAME); student.setFirstName(UPDATED_FIRST_NAME); student.setEmail(UPDATED_EMAIL); student.setPhone(UPDATED_PHONE); restStudentMockMvc .perform( put("/api/students") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(student))) .andExpect(status().isOk()); // Validate the Student in the database List<Student> students = studentRepository.findAll(); assertThat(students).hasSize(databaseSizeBeforeUpdate); Student testStudent = students.get(students.size() - 1); assertThat(testStudent.getSid()).isEqualTo(UPDATED_SID); assertThat(testStudent.getLastName()).isEqualTo(UPDATED_LAST_NAME); assertThat(testStudent.getFirstName()).isEqualTo(UPDATED_FIRST_NAME); assertThat(testStudent.getEmail()).isEqualTo(UPDATED_EMAIL); assertThat(testStudent.getPhone()).isEqualTo(UPDATED_PHONE); }
@Before public void initTest() { student = new Student(); student.setSid(DEFAULT_SID); student.setLastName(DEFAULT_LAST_NAME); student.setFirstName(DEFAULT_FIRST_NAME); student.setEmail(DEFAULT_EMAIL); student.setPhone(DEFAULT_PHONE); }