コード例 #1
0
  @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);
  }
コード例 #2
0
  @Test
  @Transactional
  public void getAllCommercialOperations() throws Exception {
    // Initialize the database
    commercialOperationRepository.saveAndFlush(commercialOperation);

    // Get all the commercialOperations
    restCommercialOperationMockMvc
        .perform(get("/api/commercialOperations"))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON))
        .andExpect(jsonPath("$.[*].id").value(hasItem(commercialOperation.getId().intValue())))
        .andExpect(jsonPath("$.[*].providerCode").value(hasItem(DEFAULT_PROVIDER_CODE.toString())));
  }
コード例 #3
0
  @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);
  }
コード例 #4
0
  @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);
  }