@Test
  public void testCreationWihtSimpleDescriptor() throws Exception {
    InputStream generatorDescriptorIn =
        getClass()
            .getResourceAsStream("/opennlp/tools/util/featuregen/TestFeatureGeneratorConfig.xml");

    // If this fails the generator descriptor could not be found
    // at the expected location
    Assert.assertNotNull(generatorDescriptorIn);

    Collection<String> expectedGenerators = new ArrayList<String>();
    expectedGenerators.add(OutcomePriorFeatureGenerator.class.getName());

    AggregatedFeatureGenerator aggregatedGenerator =
        (AggregatedFeatureGenerator) GeneratorFactory.create(generatorDescriptorIn, null);

    for (AdaptiveFeatureGenerator generator : aggregatedGenerator.getGenerators()) {

      expectedGenerators.remove(generator.getClass().getName());

      // if of kind which requires parameters check that
    }

    // If this fails not all expected generators were found and
    // removed from the expected generators collection
    Assert.assertEquals(0, expectedGenerators.size());
  }
  /**
   * Calls the {@link AdaptiveFeatureGenerator#createFeatures(List, String[], int, String[])} method
   * on all aggregated {@link AdaptiveFeatureGenerator}s.
   */
  public void createFeatures(
      List<String> features, String[] tokens, int index, String[] previousOutcomes) {

    for (AdaptiveFeatureGenerator generator : generators) {
      generator.createFeatures(features, tokens, index, previousOutcomes);
    }
  }
  @Test
  public void testCreationWithCustomGenerator() throws Exception {
    InputStream generatorDescriptorIn =
        getClass().getResourceAsStream("/opennlp/tools/util/featuregen/CustomClassLoading.xml");

    // If this fails the generator descriptor could not be found
    // at the expected location
    Assert.assertNotNull(generatorDescriptorIn);

    AggregatedFeatureGenerator aggregatedGenerator =
        (AggregatedFeatureGenerator) GeneratorFactory.create(generatorDescriptorIn, null);

    Collection<AdaptiveFeatureGenerator> embeddedGenerator = aggregatedGenerator.getGenerators();

    Assert.assertEquals(1, embeddedGenerator.size());

    for (AdaptiveFeatureGenerator generator : embeddedGenerator) {
      Assert.assertEquals(TokenFeatureGenerator.class.getName(), generator.getClass().getName());
    }
  }
  /**
   * Calls the {@link AdaptiveFeatureGenerator#updateAdaptiveData(String[], String[])} method on all
   * aggregated {@link AdaptiveFeatureGenerator}s.
   */
  public void updateAdaptiveData(String[] tokens, String[] outcomes) {

    for (AdaptiveFeatureGenerator generator : generators) {
      generator.updateAdaptiveData(tokens, outcomes);
    }
  }
  /**
   * Calls the {@link AdaptiveFeatureGenerator#clearAdaptiveData()} method on all aggregated {@link
   * AdaptiveFeatureGenerator}s.
   */
  public void clearAdaptiveData() {

    for (AdaptiveFeatureGenerator generator : generators) {
      generator.clearAdaptiveData();
    }
  }