@Test
  @Transactional
  public void getCycle() throws Exception {
    // Initialize the database
    cycleRepository.saveAndFlush(cycle);

    // Get the cycle
    restCycleMockMvc
        .perform(get("/api/cycles/{id}", cycle.getId()))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON))
        .andExpect(jsonPath("$.id").value(cycle.getId().intValue()))
        .andExpect(jsonPath("$.intitule").value(DEFAULT_INTITULE.toString()));
  }
  @Test
  @Transactional
  public void deleteCycle() throws Exception {
    // Initialize the database
    cycleRepository.saveAndFlush(cycle);

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

    // Get the cycle
    restCycleMockMvc
        .perform(delete("/api/cycles/{id}", cycle.getId()).accept(TestUtil.APPLICATION_JSON_UTF8))
        .andExpect(status().isOk());

    // Validate the database is empty
    List<Cycle> cycles = cycleRepository.findAll();
    assertThat(cycles).hasSize(databaseSizeBeforeDelete - 1);
  }
  @Test
  @Transactional
  public void updateCycle() throws Exception {
    // Initialize the database
    cycleRepository.saveAndFlush(cycle);

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

    // Update the cycle
    cycle.setIntitule(UPDATED_INTITULE);

    restCycleMockMvc
        .perform(
            put("/api/cycles")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(cycle)))
        .andExpect(status().isOk());

    // Validate the Cycle in the database
    List<Cycle> cycles = cycleRepository.findAll();
    assertThat(cycles).hasSize(databaseSizeBeforeUpdate);
    Cycle testCycle = cycles.get(cycles.size() - 1);
    assertThat(testCycle.getIntitule()).isEqualTo(UPDATED_INTITULE);
  }