throws IOException
{
Allocator allocator = new MergingByteBufferAllocator( 0, 5000 );
MemoryBuffer bf1 = allocator.allocate( 250 );
Assert.assertEquals( 250, bf1.maxCapacity() );
Assert.assertEquals( 250, bf1.capacity() );
MemoryBuffer bf2 = allocator.allocate( 251 );
Assert.assertEquals( 251, bf2.maxCapacity() );
Assert.assertEquals( 251, bf2.capacity() );
MemoryBuffer bf3 = allocator.allocate( 200 );
Assert.assertEquals( 200, bf3.maxCapacity() );
Assert.assertEquals( 200, bf3.capacity() );
MemoryBuffer bf4 = allocator.allocate( 2000 );
Assert.assertEquals( 2000, bf4.maxCapacity() );
Assert.assertEquals( 2000, bf4.capacity() );
MemoryBuffer bf5 = allocator.allocate( 2001 );
Assert.assertEquals( 2001, bf5.maxCapacity() );
Assert.assertEquals( 2001, bf5.capacity() );
MemoryBuffer bf6 = allocator.allocate( 298 );
Assert.assertEquals( 298, bf6.maxCapacity() );
Assert.assertEquals( 298, bf6.capacity() );
MemoryBuffer bf7 = allocator.allocate( 128 );
Assert.assertNull( bf7 );
allocator.close();
}