ServicePoolProxies { public static <S> com.bazaarvoice.ostrich.ServicePool<S> getPool(S dynamicProxy) { checkNotNull(dynamicProxy); checkArgument(isProxy(dynamicProxy)); @SuppressWarnings("unchecked") ServicePoolProxy<S> poolProxy = (ServicePoolProxy<S>) Proxy.getInvocationHandler(dynamicProxy); return poolProxy.getServicePool(); } private  ServicePoolProxies(); static boolean isProxy(Object dynamicProxy); static void close(S dynamicProxy); static int getNumValidEndPoints(S dynamicProxy); static int getNumBadEndPoints(S dynamicProxy); static HealthCheckResults checkForHealthyEndPoint(S dynamicProxy); static com.bazaarvoice.ostrich.ServicePool<S> getPool(S dynamicProxy);  }
@Test(expected = NullPointerException.class) public void testGetPoolNullProxy() { ServicePoolProxies.getPool(null); }
@Test(expected = IllegalArgumentException.class) public void testGetPoolNonServicePoolProxy() { ServicePoolProxies.getPool(Reflection.newProxy(Service.class, mock(InvocationHandler.class))); }
@SuppressWarnings("unchecked") @Test public void testGetPool() { ServicePool<Service> pool = mock(ServicePool.class); Service service = ServicePoolProxy.create(Service.class, mock(RetryPolicy.class), pool, mock(PartitionContextSupplier.class), true); assertSame(pool, ServicePoolProxies.getPool(service)); }