@Test
public void poolIsAbleToAllocateTheRequiredNumberOfPages() {

  final int pageCount = 10;
  MemorySegmentPool pool = new MemorySegmentPool(pageCount * MemorySegmentPool.PAGE_SIZE);
  for (int i = 0; i < pageCount; i++) {
    MemorySegment segment = pool.nextSegment();
    assertThat(segment, notNullValue());
    assertThat(segment.size(), is(MemorySegmentPool.PAGE_SIZE));
  }
  assertThat(pool.nextSegment(), nullValue());
}