@Test
 public void testIsReusable() throws Exception {
   NativeMemoryChunk chunk = mPool.get(1);
   Assert.assertTrue(mPool.isReusable(chunk));
   chunk.close();
   Assert.assertFalse(mPool.isReusable(chunk));
 }
 @Test
 public void testGetSizeInBytes() throws Exception {
   Assert.assertEquals(1, mPool.getSizeInBytes(1));
   Assert.assertEquals(32, mPool.getSizeInBytes(32));
   Assert.assertEquals(33, mPool.getSizeInBytes(33));
   Assert.assertEquals(64, mPool.getSizeInBytes(64));
   Assert.assertEquals(69, mPool.getSizeInBytes(69));
 }
 @Test
 public void testFree() throws Exception {
   NativeMemoryChunk c = mPool.alloc(1);
   Assert.assertFalse(c.isClosed());
   mPool.free(c);
   Assert.assertTrue(c.isClosed());
   mPool.free(c);
   Assert.assertTrue(c.isClosed());
 }
 // Test out the alloc method
 @Test
 public void testAlloc() throws Exception {
   NativeMemoryChunk c = mPool.alloc(1);
   Assert.assertNotNull(c);
   Assert.assertEquals(1, c.getSize());
   Assert.assertEquals(1, mPool.alloc(1).getSize());
   Assert.assertEquals(33, mPool.alloc(33).getSize());
   Assert.assertEquals(32, mPool.alloc(32).getSize());
 }
  // tests out the getBucketedSizeForValue method
  @Test
  public void testGetBucketedSizeForValue() throws Exception {
    Assert.assertEquals(32, mPool.getBucketedSizeForValue(new FakeNativeMemoryChunk(32)));
    Assert.assertEquals(64, mPool.getBucketedSizeForValue(new FakeNativeMemoryChunk(64)));
    Assert.assertEquals(128, mPool.getBucketedSizeForValue(new FakeNativeMemoryChunk(128)));

    // test with non-bucket values
    Assert.assertEquals(1, mPool.getBucketedSizeForValue(new FakeNativeMemoryChunk(1)));
    Assert.assertEquals(129, mPool.getBucketedSizeForValue(new FakeNativeMemoryChunk(129)));
    Assert.assertEquals(31, mPool.getBucketedSizeForValue(new FakeNativeMemoryChunk(31)));
  }
  // tests out the getBucketedSize method
  @Test
  public void testGetBucketedSize() throws Exception {
    Assert.assertEquals(32, mPool.getBucketedSize(1));
    Assert.assertEquals(32, mPool.getBucketedSize(32));
    Assert.assertEquals(64, mPool.getBucketedSize(33));
    Assert.assertEquals(64, mPool.getBucketedSize(64));
    Assert.assertEquals(128, mPool.getBucketedSize(69));

    // value larger than max bucket
    Assert.assertEquals(129, mPool.getBucketedSize(129));

    int[] invalidSizes = new int[] {-1, 0};
    for (int size : invalidSizes) {
      try {
        mPool.getBucketedSize(size);
        Assert.fail();
      } catch (BasePool.InvalidSizeException e) {
        // do nothing
      }
    }
  }