@Test @Transactional public void getStudent() throws Exception { // Initialize the database studentRepository.saveAndFlush(student); // Get the student restStudentMockMvc .perform(get("/api/students/{id}", student.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(student.getId().intValue())) .andExpect(jsonPath("$.sid").value(DEFAULT_SID.toString())) .andExpect(jsonPath("$.lastName").value(DEFAULT_LAST_NAME.toString())) .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRST_NAME.toString())) .andExpect(jsonPath("$.email").value(DEFAULT_EMAIL.toString())) .andExpect(jsonPath("$.phone").value(DEFAULT_PHONE.toString())); }
@Test @Transactional public void deleteStudent() throws Exception { // Initialize the database studentRepository.saveAndFlush(student); int databaseSizeBeforeDelete = studentRepository.findAll().size(); // Get the student restStudentMockMvc .perform( delete("/api/students/{id}", student.getId()).accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Student> students = studentRepository.findAll(); assertThat(students).hasSize(databaseSizeBeforeDelete - 1); }