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

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

    // Get the commercialOperation
    restCommercialOperationMockMvc
        .perform(
            delete("/api/commercialOperations/{id}", commercialOperation.getId())
                .accept(TestUtil.APPLICATION_JSON_UTF8))
        .andExpect(status().isOk());

    // Validate the database is empty
    List<CommercialOperation> commercialOperations = commercialOperationRepository.findAll();
    assertThat(commercialOperations).hasSize(databaseSizeBeforeDelete - 1);
  }
  @Test
  @Transactional
  public void createCommercialOperation() throws Exception {
    int databaseSizeBeforeCreate = commercialOperationRepository.findAll().size();

    // Create the CommercialOperation
    restCommercialOperationMockMvc
        .perform(
            post("/api/commercialOperations")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(
                    TestUtil.convertObjectToJsonBytes(
                        new DetailedCommercialOperationDTO(
                            new DetailedCommercialOperation(commercialOperation)))))
        .andExpect(status().isCreated());

    // Validate the CommercialOperation in the database
    List<CommercialOperation> commercialOperations = commercialOperationRepository.findAll();
    assertThat(commercialOperations).hasSize(databaseSizeBeforeCreate + 1);
    CommercialOperation testCommercialOperation =
        commercialOperations.get(commercialOperations.size() - 1);
    assertThat(testCommercialOperation.getProviderCode()).isEqualTo(DEFAULT_PROVIDER_CODE);
  }
  @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);
  }