@Test
  @Transactional
  public void updateCommercialOperation() throws Exception {
    // Initialize the database
    commercialOperationRepository.saveAndFlush(commercialOperation);

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

    // Update the commercialOperation
    commercialOperation.setProviderCode(UPDATED_PROVIDER_CODE);
    restCommercialOperationMockMvc
        .perform(
            put("/api/commercialOperations")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(commercialOperation)))
        .andExpect(status().isOk());

    // Validate the CommercialOperation in the database
    List<CommercialOperation> commercialOperations = commercialOperationRepository.findAll();
    assertThat(commercialOperations).hasSize(databaseSizeBeforeUpdate);
    CommercialOperation testCommercialOperation =
        commercialOperations.get(commercialOperations.size() - 1);
    assertThat(testCommercialOperation.getProviderCode()).isEqualTo(UPDATED_PROVIDER_CODE);
  }
 @Before
 public void initTest() {
   commercialOperation = new CommercialOperation();
   commercialOperation.setProviderCode(DEFAULT_PROVIDER_CODE);
 }