@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);
  }
 @Before
 public void initTest() {
   aluno = new Aluno();
   aluno.setNome(DEFAULT_NOME);
   aluno.setCpf(DEFAULT_CPF);
   aluno.setEndereco(DEFAULT_ENDERECO);
 }
  @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);
  }