Пример #1
0
  @Test
  @Transactional
  public void getAllSocios() throws Exception {
    // Initialize the database
    socioRepository.saveAndFlush(socio);

    // Get all the socios
    restSocioMockMvc
        .perform(get("/api/socios"))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON))
        .andExpect(jsonPath("$.[*].id").value(hasItem(socio.getId().intValue())))
        .andExpect(jsonPath("$.[*].nombre").value(hasItem(DEFAULT_NOMBRE.toString())));
  }
Пример #2
0
  @Test
  @Transactional
  public void deleteSocio() throws Exception {
    // Initialize the database
    socioRepository.saveAndFlush(socio);

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

    // Get the socio
    restSocioMockMvc
        .perform(delete("/api/socios/{id}", socio.getId()).accept(TestUtil.APPLICATION_JSON_UTF8))
        .andExpect(status().isOk());

    // Validate the database is empty
    List<Socio> socios = socioRepository.findAll();
    assertThat(socios).hasSize(databaseSizeBeforeDelete - 1);
  }
Пример #3
0
  @Test
  @Transactional
  public void updateSocio() throws Exception {
    // Initialize the database
    socioRepository.saveAndFlush(socio);

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

    // Update the socio
    socio.setNombre(UPDATED_NOMBRE);

    restSocioMockMvc
        .perform(
            put("/api/socios")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(socio)))
        .andExpect(status().isOk());

    // Validate the Socio in the database
    List<Socio> socios = socioRepository.findAll();
    assertThat(socios).hasSize(databaseSizeBeforeUpdate);
    Socio testSocio = socios.get(socios.size() - 1);
    assertThat(testSocio.getNombre()).isEqualTo(UPDATED_NOMBRE);
  }