@Test
public void subResult()
{

  final LdapEntry entry1 = LdapEntry.builder()
    .dn("uid=1").build();
  final LdapEntry entry2 = LdapEntry.builder()
    .dn("uid=2").build();
  final SearchResponse sr = new SearchResponse();
  sr.addEntries(entry2, entry1);
  Assert.assertEquals(sr.subResult(2, 2).entrySize(), 0);
  Assert.assertEquals(sr.subResult(1, 2).entrySize(), 1);
  Assert.assertEquals(sr.subResult(0, 2).entrySize(), 2);
  try {
    sr.subResult(-1, 1);
    Assert.fail("Should have thrown IndexOutOfBoundsException");
  } catch (Exception e) {
    Assert.assertEquals(e.getClass(), IndexOutOfBoundsException.class);
  }
  try {
    sr.subResult(0, 3);
    Assert.fail("Should have thrown IndexOutOfBoundsException");
  } catch (Exception e) {
    Assert.assertEquals(e.getClass(), IndexOutOfBoundsException.class);
  }
  try {
    sr.subResult(1, 0);
    Assert.fail("Should have thrown IndexOutOfBoundsException");
  } catch (Exception e) {
    Assert.assertEquals(e.getClass(), IndexOutOfBoundsException.class);
  }
}