@Test
  public void testReferringDocumentsStatement() {
    final String referrersStatement1 =
        ReferringDocumentsProvider.createReferrersStatement(
            false, "cafebabe-cafe-babe-cafe-babecafebabe", 1);
    assertEquals(
        "//element(*,hippo:handle)[*/hippo:availability='live' and (*/@hippo:docbase='cafebabe-cafe-babe-cafe-babecafebabe')] order by @jcr:name ascending",
        referrersStatement1);
    final String referrersStatement2 =
        ReferringDocumentsProvider.createReferrersStatement(
            false, "cafebabe-cafe-babe-cafe-babecafebabe", 2);
    assertEquals(
        "//element(*,hippo:handle)[*/hippo:availability='live' and (*/@hippo:docbase='cafebabe-cafe-babe-cafe-babecafebabe' or */*/@hippo:docbase='cafebabe-cafe-babe-cafe-babecafebabe')] order by @jcr:name ascending",
        referrersStatement2);

    final String referrersStatement3 =
        ReferringDocumentsProvider.createReferrersStatement(
            false, "cafebabe-cafe-babe-cafe-babecafebabe", 3);
    assertEquals(
        "//element(*,hippo:handle)[*/hippo:availability='live' and (*/@hippo:docbase='cafebabe-cafe-babe-cafe-babecafebabe' or */*/@hippo:docbase='cafebabe-cafe-babe-cafe-babecafebabe' or */*/*/@hippo:docbase='cafebabe-cafe-babe-cafe-babecafebabe')] order by @jcr:name ascending",
        referrersStatement3);
  }
 @Test(expected = IllegalArgumentException.class)
 public void testReferringDocumentsStatementDepthAtLeast1() {
   ReferringDocumentsProvider.createReferrersStatement(
       false, "cafebabe-cafe-babe-cafe-babecafebabe", 0);
 }