001/**
002 * Copyright (c) 2008-2014 Ardor Labs, Inc.
003 *
004 * This file is part of Ardor3D.
005 *
006 * Ardor3D is free software: you can redistribute it and/or modify it 
007 * under the terms of its license which may be found in the accompanying
008 * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
009 */
010
011package com.ardor3d.math;
012
013import org.junit.Test;
014
015public class TestObjectPool {
016
017    @Test(expected = RuntimeException.class)
018    public void testPoolReleaseNullError() {
019        Vector2.releaseTempInstance(null);
020    }
021
022    @Test(expected = RuntimeException.class)
023    public void testPoolBadClass() {
024        ObjectPool.create(Poolable.class, 10).fetch();
025    }
026
027    @Test
028    public void testPoolSize() {
029        final ObjectPool<Vector2> pool = ObjectPool.create(Vector2.class, 10);
030        for (int i = 0; i < 11; i++) {
031            pool.release(new Vector2());
032        }
033    }
034}