describe('Pool', function () {
    var Pool;
    it('require', function () {
        Pool = require('../../lib/common/Pool.js').Pool;
        expect(Pool).not.toBeNull();
    });
    
    it('creation', function () {
       var pool = new Pool();
       //console.log('pool', pool._spareObject);
       expect(pool._spareObjects).toEqual([]);
       expect(pool._waitingCallbacks).toEqual([]);
   });
   
   it('add object', function () {
       var pool = new Pool();
       var fakeObj = 'a';
       
       expect(pool.getWaitingLength()).toEqual(0);
       expect(pool.getSpareLength()).toEqual(0);
       pool.add(fakeObj);
       expect(pool.getWaitingLength()).toEqual(0);
       expect(pool.getSpareLength()).toEqual(1);
   });
   
   it('get and release', function () {
       var pool = new Pool();
       var callbackMock = jasmine.createSpy();
       var fakeObj = 'a';
       pool.add(fakeObj);
       pool.get(callbackMock);
       expect(callbackMock).toHaveBeenCalledWith(fakeObj);
       expect(pool.getWaitingLength()).toEqual(0);
       expect(pool.getSpareLength()).toEqual(0);
       pool.release(fakeObj);
       expect(pool.getWaitingLength()).toEqual(0);
       expect(pool.getSpareLength()).toEqual(1);
   });
   
   it('mark known objects for deletion', function () {
       var pool = new Pool(), fakeObj1 = 'a', fakeObj2 = 'b';
       pool.add(fakeObj1);
       expect(pool.getSpareLength()).toEqual(1);
       pool.markForDeletion();
       expect(pool.getWaitingLength()).toEqual(0);
       expect(pool.getSpareLength()).toEqual(0);
       pool.add(fakeObj2);
       pool.get(function () {
           expect(arguments[0]).toEqual(fakeObj2);
       });
   });
   
   it('add and release', function () {
       var pool = new Pool(), fakeObj1 = 'a', fakeObj2 = 'b';
       pool.add(fakeObj1);
       expect(pool.getSpareLength()).toEqual(1);
   });
});