public void shouldNotDeleteCatalogUsed()

in component-test/src/main/java/org/apache/fineract/cn/customer/catalog/TestCatalog.java [226:255]


  public void shouldNotDeleteCatalogUsed() throws Exception {
    final Catalog catalog = CatalogGenerator.createRandomCatalog();

    this.catalogManager.createCatalog(catalog);
    this.eventRecorder.wait(CatalogEventConstants.POST_CATALOG, catalog.getIdentifier());

    final Customer randomCustomer = CustomerGenerator.createRandomCustomer();
    randomCustomer.setCustomValues(catalog.getFields()
        .stream()
        .map(field -> {
          final Value value = new Value();
          value.setCatalogIdentifier(catalog.getIdentifier());
          value.setFieldIdentifier(field.getIdentifier());
          switch (Field.DataType.valueOf(field.getDataType())) {
            case NUMBER:
              value.setValue("25.00");
              break;
            case SINGLE_SELECTION:
              value.setValue("1");
          }
          return value;
        })
        .collect(Collectors.toList())
    );

    this.customerManager.createCustomer(randomCustomer);
    this.eventRecorder.wait(CustomerEventConstants.POST_CUSTOMER, randomCustomer.getIdentifier());

    this.catalogManager.deleteCatalog(catalog.getIdentifier());
  }