Source:
<code><START> public void testCompositeStrategy() throws Exception { <END> MaxConnectionsBasedStrategy global = new MaxConnectionsBasedStrategy(1); MaxConnectionsBasedStrategy local = new MaxConnectionsBasedStrategy(2); CompositePoolLimitDeterminationStrategy strategy = new CompositePoolLimitDeterminationStrategy(local, global); Assert.assertTrue("Invalid permit acquire failure.", strategy.acquireCreationPermit()); Assert.assertEquals("Unexpected available global permits.", 0, global.getAvailablePermits()); Assert.assertEquals("Unexpected available local permits.", 1, local.getAvailablePermits()); Assert.assertEquals("Unexpected available composite permits.", 0, strategy.getAvailablePermits()); Assert.assertFalse("Invalid permit acquire success.", strategy.acquireCreationPermit()); Assert.assertEquals("Unexpected available global permits.", 0, global.getAvailablePermits()); Assert.assertEquals("Unexpected available local permits.", 1, local.getAvailablePermits()); Assert.assertEquals("Unexpected available composite permits.", 0, strategy.getAvailablePermits()); strategy.onNext(PoolInsightProvider.StateChangeEvent.OnConnectionEviction); Assert.assertEquals("Unexpected available global permits.", 1, global.getAvailablePermits()); Assert.assertEquals("Unexpected available local permits.", 2, local.getAvailablePermits()); Assert.assertEquals("Unexpected available composite permits.", 1, strategy.getAvailablePermits()); Assert.assertTrue("Invalid permit acquire failure.", strategy.acquireCreationPermit()); Assert.assertEquals("Unexpected available global permits.", 0, global.getAvailablePermits()); Assert.assertEquals("Unexpected available local permits.", 1, local.getAvailablePermits()); Assert.assertEquals("Unexpected available composite permits.", 0, strategy.getAvailablePermits()); }</code><technical_language>I wondering if write another test case test normal situation global permits greater local permits. some tests showing max connections resettable good</technical_language>

Target:
public void testCompositeStrategy() throws Exception { MaxConnectionsBasedStrategy global = new MaxConnectionsBasedStrategy(1); MaxConnectionsBasedStrategy local = new MaxConnectionsBasedStrategy(2); CompositePoolLimitDeterminationStrategy strategy = new CompositePoolLimitDeterminationStrategy(local, global); Assert.assertTrue("Invalid permit acquire failure.", strategy.acquireCreationPermit()); Assert.assertEquals("Unexpected available global permits.", 0, global.getAvailablePermits()); Assert.assertEquals("Unexpected available local permits.", 1, local.getAvailablePermits()); Assert.assertEquals("Unexpected available composite permits.", 0, strategy.getAvailablePermits()); Assert.assertFalse("Invalid permit acquire success.", strategy.acquireCreationPermit()); Assert.assertEquals("Unexpected available global permits.", 0, global.getAvailablePermits()); Assert.assertEquals("Unexpected available local permits.", 1, local.getAvailablePermits()); Assert.assertEquals("Unexpected available composite permits.", 0, strategy.getAvailablePermits()); strategy.onNext(PoolInsightProvider.PoolStateChangeEvent.OnConnectionEviction); Assert.assertEquals("Unexpected available global permits.", 1, global.getAvailablePermits()); Assert.assertEquals("Unexpected available local permits.", 2, local.getAvailablePermits()); Assert.assertEquals("Unexpected available composite permits.", 1, strategy.getAvailablePermits()); Assert.assertTrue("Invalid permit acquire failure.", strategy.acquireCreationPermit()); Assert.assertEquals("Unexpected available global permits.", 0, global.getAvailablePermits()); Assert.assertEquals("Unexpected available local permits.", 1, local.getAvailablePermits()); Assert.assertEquals("Unexpected available composite permits.", 0, strategy.getAvailablePermits()); }