@Test
 public void testSetMaxInvalid() throws Exception {
   final LocalConnFactory connFactory = Mockito.mock(LocalConnFactory.class);
   final LocalConnPool pool = new LocalConnPool(connFactory, 2, 2);
   try {
     pool.setMaxTotal(-1);
     Assert.fail("IllegalArgumentException should have been thrown");
   } catch (final IllegalArgumentException expected) {
   }
   try {
     pool.setMaxPerRoute(null, 1);
     Assert.fail("IllegalArgumentException should have been thrown");
   } catch (final IllegalArgumentException expected) {
   }
   try {
     pool.setMaxPerRoute("somehost", -1);
     Assert.fail("IllegalArgumentException should have been thrown");
   } catch (final IllegalArgumentException expected) {
   }
   try {
     pool.setDefaultMaxPerRoute(-1);
     Assert.fail("IllegalArgumentException should have been thrown");
   } catch (final IllegalArgumentException expected) {
   }
 }
 @Test
 public void testEmptyPool() throws Exception {
   final LocalConnFactory connFactory = Mockito.mock(LocalConnFactory.class);
   final LocalConnPool pool = new LocalConnPool(connFactory, 2, 10);
   pool.setDefaultMaxPerRoute(5);
   pool.setMaxPerRoute("somehost", 3);
   final PoolStats totals = pool.getTotalStats();
   Assert.assertEquals(0, totals.getAvailable());
   Assert.assertEquals(0, totals.getLeased());
   Assert.assertEquals(10, totals.getMax());
   Assert.assertEquals(Collections.emptySet(), pool.getRoutes());
   final PoolStats stats = pool.getStats("somehost");
   Assert.assertEquals(0, stats.getAvailable());
   Assert.assertEquals(0, stats.getLeased());
   Assert.assertEquals(3, stats.getMax());
   Assert.assertEquals("[leased: []][available: []][pending: []]", pool.toString());
 }