@Test
  @Transactional
  public void updateAluno() throws Exception {
    // Initialize the database
    alunoRepository.saveAndFlush(aluno);

    int databaseSizeBeforeUpdate = alunoRepository.findAll().size();

    // Update the aluno
    aluno.setNome(UPDATED_NOME);
    aluno.setCpf(UPDATED_CPF);
    aluno.setEndereco(UPDATED_ENDERECO);

    restAlunoMockMvc
        .perform(
            put("/api/alunos")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(aluno)))
        .andExpect(status().isOk());

    // Validate the Aluno in the database
    List<Aluno> alunos = alunoRepository.findAll();
    assertThat(alunos).hasSize(databaseSizeBeforeUpdate);
    Aluno testAluno = alunos.get(alunos.size() - 1);
    assertThat(testAluno.getNome()).isEqualTo(UPDATED_NOME);
    assertThat(testAluno.getCpf()).isEqualTo(UPDATED_CPF);
    assertThat(testAluno.getEndereco()).isEqualTo(UPDATED_ENDERECO);
  }
  @Test
  @Transactional
  public void deleteAluno() throws Exception {
    // Initialize the database
    alunoRepository.saveAndFlush(aluno);

    int databaseSizeBeforeDelete = alunoRepository.findAll().size();

    // Get the aluno
    restAlunoMockMvc
        .perform(delete("/api/alunos/{id}", aluno.getId()).accept(TestUtil.APPLICATION_JSON_UTF8))
        .andExpect(status().isOk());

    // Validate the database is empty
    List<Aluno> alunos = alunoRepository.findAll();
    assertThat(alunos).hasSize(databaseSizeBeforeDelete - 1);
  }
  @Test
  @Transactional
  public void checkEnderecoIsRequired() throws Exception {
    int databaseSizeBeforeTest = alunoRepository.findAll().size();
    // set the field null
    aluno.setEndereco(null);

    // Create the Aluno, which fails.

    restAlunoMockMvc
        .perform(
            post("/api/alunos")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(aluno)))
        .andExpect(status().isBadRequest());

    List<Aluno> alunos = alunoRepository.findAll();
    assertThat(alunos).hasSize(databaseSizeBeforeTest);
  }
  @Test
  @Transactional
  public void createAluno() throws Exception {
    int databaseSizeBeforeCreate = alunoRepository.findAll().size();

    // Create the Aluno

    restAlunoMockMvc
        .perform(
            post("/api/alunos")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(aluno)))
        .andExpect(status().isCreated());

    // Validate the Aluno in the database
    List<Aluno> alunos = alunoRepository.findAll();
    assertThat(alunos).hasSize(databaseSizeBeforeCreate + 1);
    Aluno testAluno = alunos.get(alunos.size() - 1);
    assertThat(testAluno.getNome()).isEqualTo(DEFAULT_NOME);
    assertThat(testAluno.getCpf()).isEqualTo(DEFAULT_CPF);
    assertThat(testAluno.getEndereco()).isEqualTo(DEFAULT_ENDERECO);
  }
  @Test
  @Transactional
  public void getAluno() throws Exception {
    // Initialize the database
    alunoRepository.saveAndFlush(aluno);

    // Get the aluno
    restAlunoMockMvc
        .perform(get("/api/alunos/{id}", aluno.getId()))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON))
        .andExpect(jsonPath("$.id").value(aluno.getId().intValue()))
        .andExpect(jsonPath("$.nome").value(DEFAULT_NOME.toString()))
        .andExpect(jsonPath("$.cpf").value(DEFAULT_CPF.toString()))
        .andExpect(jsonPath("$.endereco").value(DEFAULT_ENDERECO.toString()));
  }