@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); }
@Test @Transactional public void createSocio() throws Exception { int databaseSizeBeforeCreate = socioRepository.findAll().size(); // Create the Socio restSocioMockMvc .perform( post("/api/socios") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(socio))) .andExpect(status().isCreated()); // Validate the Socio in the database List<Socio> socios = socioRepository.findAll(); assertThat(socios).hasSize(databaseSizeBeforeCreate + 1); Socio testSocio = socios.get(socios.size() - 1); assertThat(testSocio.getNombre()).isEqualTo(DEFAULT_NOMBRE); }
@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()))); }
@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); }