/**
   * The {@link DesignatorInterpreter#enrich(Treepath, FragmentMapper)} method adds and removes
   * trees so it introduces an index shift. By calling this method two times we check proper
   * handling of index shift.
   */
  @Test
  public void enrichTwoTimesToCheckResistanceToIndexShift() {
    final SyntacticTree levelTree0 = tree(_LEVEL, tree(ABSOLUTE_IDENTIFIER, tree("L0")));

    final SyntacticTree levelTree1 = tree(_LEVEL, tree(ABSOLUTE_IDENTIFIER, tree("L1")));

    final SyntacticTree partTree = tree(NOVELLA, levelTree0, levelTree1);

    final RobustPath<SyntacticTree> path0 =
        RobustPath.create(Treepath.create(partTree, 0), DesignatorTools.IDENTIFIER_TREE_FILTER);
    final RobustPath<SyntacticTree> path1 =
        RobustPath.create(Treepath.create(partTree, 1), DesignatorTools.IDENTIFIER_TREE_FILTER);

    verifyEnrich(
        tree(
            NOVELLA,
            tree(_LEVEL, tree(_EXPLICIT_IDENTIFIER, "L0")),
            tree(_LEVEL, tree(_EXPLICIT_IDENTIFIER, "L1"))),
        partTree,
        new FragmentMapperBuilder()
            .addPure(new FragmentIdentifier("L0"), path0)
            .addPure(new FragmentIdentifier("L1"), path1)
            .build());
  }
  @Test
  public void enrichWithSimpleAbsoluteIdentifier() {
    final SyntacticTree levelTree = tree(_LEVEL, tree(ABSOLUTE_IDENTIFIER, tree("L0")));

    final SyntacticTree partTree = tree(NOVELLA, levelTree);

    final Treepath<SyntacticTree> levelTreepath = Treepath.create(partTree, 0);

    verifyEnrich(
        tree(NOVELLA, tree(_LEVEL, tree(_EXPLICIT_IDENTIFIER, "L0"))),
        partTree,
        new FragmentMapperBuilder()
            .addPure(
                new FragmentIdentifier("L0"),
                RobustPath.create(levelTreepath, DesignatorTools.IDENTIFIER_TREE_FILTER))
            .build());
  }
  @Test
  public void enrichWithSimpleImplicitIdentifier() {

    final SyntacticTree levelTree = tree(_LEVEL);

    final SyntacticTree partTree = tree(NOVELLA, levelTree);

    final Treepath<SyntacticTree> levelTreepath = Treepath.create(partTree, 0);

    final FragmentMapper<RobustPath<SyntacticTree>> mapper =
        new FragmentMapperBuilder()
            .addDerived(
                new FragmentIdentifier("L0"),
                RobustPath.create(levelTreepath, DesignatorTools.IDENTIFIER_TREE_FILTER))
            .build();

    verifyEnrich(tree(NOVELLA, tree(_LEVEL, tree(_IMPLICIT_IDENTIFIER, "L0"))), partTree, mapper);
  }