@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);
  }
  @Test
  @Transactional
  public void createOperation() throws Exception {
    int databaseSizeBeforeCreate = operationRepository.findAll().size();

    // Create the Operation

    restOperationMockMvc
        .perform(
            post("/api/operations")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(operation)))
        .andExpect(status().isCreated());

    // Validate the Operation in the database
    List<Operation> operations = operationRepository.findAll();
    assertThat(operations).hasSize(databaseSizeBeforeCreate + 1);
    Operation testOperation = operations.get(operations.size() - 1);
    assertThat(testOperation.getDate()).isEqualTo(DEFAULT_DATE);
    assertThat(testOperation.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
    assertThat(testOperation.getAmount()).isEqualTo(DEFAULT_AMOUNT);

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