@Test
void testComposite() {

    StoreRefFactory refDesc = null;
    MatchIndex matchIndex = null;
    TextRefFactory textDesc = null;
    final RefParser refParser = new RefParser();
    final List<RefFactory> sections = refParser.parse("$heading$1[+3]+'test'+'2'+$heading2$+$3+$heading3$[5]");
    assertThat(sections.size()).isEqualTo(6);
    refDesc = (StoreRefFactory) sections.get(0);
    assertThat(refDesc.getRefId()).isEqualTo("heading");
    assertThat(refDesc.getRefGroup()).isEqualTo(1);
    matchIndex = refDesc.getMatchIndex();
    assertThat(matchIndex.isOffset()).isEqualTo(true);
    assertThat(matchIndex.getIndex()).isEqualTo(3);
    textDesc = (TextRefFactory) sections.get(1);
    assertThat(textDesc.getText()).isEqualTo("test");
    textDesc = (TextRefFactory) sections.get(2);
    assertThat(textDesc.getText()).isEqualTo("2");
    refDesc = (StoreRefFactory) sections.get(3);
    assertThat(refDesc.getRefId()).isEqualTo("heading2");
    assertThat(refDesc.getRefGroup()).isEqualTo(0);
    matchIndex = refDesc.getMatchIndex();
    assertThat(matchIndex).isNull();
    refDesc = (StoreRefFactory) sections.get(4);
    assertThat(refDesc.getRefId()).isNull();
    assertThat(refDesc.getRefGroup()).isEqualTo(3);
    matchIndex = refDesc.getMatchIndex();
    assertThat(matchIndex).isNull();
    refDesc = (StoreRefFactory) sections.get(5);
    assertThat(refDesc.getRefId()).isEqualTo("heading3");
    assertThat(refDesc.getRefGroup()).isEqualTo(0);
    matchIndex = refDesc.getMatchIndex();
    assertThat(matchIndex.isOffset()).isEqualTo(false);
    assertThat(matchIndex.getIndex()).isEqualTo(5);
}