  @Test
  public void testDataProvided() {

    AvailableSegment<TestItem> a = new AvailableSegment<>(model, 2);

    assertNull(a.get(20));
    assertNull(a.get(29));
    assertNull(a.get(19));
    assertNull(a.get(30));
    assertEquals(0, a.getMaxIndex());

    a.dataProvided(TestItem.range(20, 29));

    assertEquals("p.20", a.get(20).toString());
    assertEquals("p.28", a.get(28).toString());
    assertNull(a.get(19));
    assertNull(a.get(29));
    assertNull(a.get(30));
    assertEquals(29, a.getMaxIndex());

    a.dataProvided(TestItem.range(20, 30));
    assertEquals(30, a.getMaxIndex());
    assertEquals("p.29", a.get(29).toString());

    a.dataProvided(null);
    assertNull(a.get(20));
    assertNull(a.get(29));
    assertNull(a.get(19));
    assertNull(a.get(30));
    assertEquals(0, a.getMaxIndex());
  }