public void shouldCreateCatalog()

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


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

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

    final Catalog savedCatalog = this.catalogManager.findCatalog(catalog.getIdentifier());
    Assert.assertEquals(catalog.getIdentifier(), savedCatalog.getIdentifier());
    Assert.assertEquals(catalog.getName(), savedCatalog.getName());
    Assert.assertEquals(catalog.getDescription(), savedCatalog.getDescription());
    Assert.assertNotNull(savedCatalog.getCreatedBy());
    Assert.assertNotNull(savedCatalog.getCreatedOn());
    Assert.assertTrue(catalog.getFields().size() == savedCatalog.getFields().size());
    savedCatalog.getFields().forEach(field -> {
      if (field.getOptions() != null) {
        Assert.assertTrue(field.getOptions().size() > 0);
        Assert.assertEquals(Integer.valueOf(1), field.getOptions().get(0).getValue());
      } else {
        if (field.getDataType().equals(Field.DataType.SINGLE_SELECTION.name())) {
          Assert.fail();
        }
      }
    });
  }