@Test
  @Transactional
  public void updateOperation() throws Exception {
    // Initialize the database
    operationRepository.saveAndFlush(operation);
    operationSearchRepository.save(operation);
    int databaseSizeBeforeUpdate = operationRepository.findAll().size();

    // Update the operation
    Operation updatedOperation = operationRepository.findOne(operation.getId());
    updatedOperation.setDate(UPDATED_DATE);
    updatedOperation.setDescription(UPDATED_DESCRIPTION);
    updatedOperation.setAmount(UPDATED_AMOUNT);

    restOperationMockMvc
        .perform(
            put("/api/operations")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(updatedOperation)))
        .andExpect(status().isOk());

    // Validate the Operation in the database
    List<Operation> operations = operationRepository.findAll();
    assertThat(operations).hasSize(databaseSizeBeforeUpdate);
    Operation testOperation = operations.get(operations.size() - 1);
    assertThat(testOperation.getDate()).isEqualTo(UPDATED_DATE);
    assertThat(testOperation.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
    assertThat(testOperation.getAmount()).isEqualTo(UPDATED_AMOUNT);

    // Validate the Operation in ElasticSearch
    Operation operationEs = operationSearchRepository.findOne(testOperation.getId());
    assertThat(operationEs).isEqualToComparingFieldByField(testOperation);
  }