@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);
 }
  @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);
  }
  @Test
  @Transactional
  public void createStudent() throws Exception {
    int databaseSizeBeforeCreate = studentRepository.findAll().size();

    // Create the Student

    restStudentMockMvc
        .perform(
            post("/api/students")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(student)))
        .andExpect(status().isCreated());

    // Validate the Student in the database
    List<Student> students = studentRepository.findAll();
    assertThat(students).hasSize(databaseSizeBeforeCreate + 1);
    Student testStudent = students.get(students.size() - 1);
    assertThat(testStudent.getSid()).isEqualTo(DEFAULT_SID);
    assertThat(testStudent.getLastName()).isEqualTo(DEFAULT_LAST_NAME);
    assertThat(testStudent.getFirstName()).isEqualTo(DEFAULT_FIRST_NAME);
    assertThat(testStudent.getEmail()).isEqualTo(DEFAULT_EMAIL);
    assertThat(testStudent.getPhone()).isEqualTo(DEFAULT_PHONE);
  }
  @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);
  }