  @Test
  public void testMultipleSentencesExpansion() throws Exception {

    ContextFreeGrammar contextFreeGrammar = new ContextFreeGrammar(nonTerminals, terminals, rules, startSymbol);
    String[] expansion = contextFreeGrammar.leftMostDerivation("S", "CJ", "S");
    assertArrayEquals(new String[]{"the", "man", "works", "and", "the", "man", "works"}, expansion);
    checkExpansion(expansion);
    expansion = contextFreeGrammar.leftMostDerivation("S", "DJ", "S", "CJ", "P");
    assertArrayEquals(new String[]{"the", "man", "works", "but", "the", "man", "works", "and", "the", "man", "works",
            "and", "the", "man", "works"}, expansion);
    checkExpansion(expansion);
  }