예제 #1
0
  @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);
  }
예제 #2
0
  @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);
  }