// Path: core/src/main/java/com/bazaarvoice/ostrich/HealthCheckResults.java
// public interface HealthCheckResults {
//     /**
//      * @return {@code true} if there is a healthy result, {@code false} otherwise.
//      */
//     boolean hasHealthyResult();
// 
//     /**
//      * @return All results in the aggregate, regardless of health.
//      */
//     Iterable<HealthCheckResult> getAllResults();
// 
//     /**
//      * Returns a healthy result if {@link #hasHealthyResult} is {@code true}. Returns {@code null} when
//      * {@code hasHealthyResult} is false. If there are multiple healthy results, there is no guarantee as to which gets
//      * returned.
//      * @return A result in the aggregate whose {@link HealthCheckResult#isHealthy} method returns {@code true}, or
//      * {@code null} if there are none.
//      */
//     HealthCheckResult getHealthyResult();
// 
//     /**
//      * @return Results in the aggregate whose {@link HealthCheckResult#isHealthy} method returns {@code false}.
//      */
//     Iterable<HealthCheckResult> getUnhealthyResults();
// }


import com.bazaarvoice.ostrich.HealthCheckResults;
import com.bazaarvoice.ostrich.RetryPolicy;
import com.bazaarvoice.ostrich.ServicePool;
import com.google.common.reflect.Reflection;
import org.junit.Test;
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
        Service service = Reflection.newProxy(Service.class, mock(InvocationHandler.class));

        assertFalse(ServicePoolProxies.isProxy(service));
    }

    @Test
    public void testIsProxy() throws IOException {
        @SuppressWarnings("unchecked")
        Service service = ServicePoolProxy.create(Service.class, mock(RetryPolicy.class), mock(ServicePool.class),
                mock(PartitionContextSupplier.class), true);

        assertTrue(ServicePoolProxies.isProxy(service));
    }

    @Test
    public void testClose() throws IOException {
        @SuppressWarnings("unchecked")
        ServicePool<Service> pool = mock(ServicePool.class);
        Service service = ServicePoolProxy.create(Service.class, mock(RetryPolicy.class), pool,
                mock(PartitionContextSupplier.class), true);

        ServicePoolProxies.close(service);

        verify(pool).close();
    }

    @SuppressWarnings("unchecked")
    @Test
    public void testCheckForHealthyEndPoint() {
        ServicePool<Service> pool = mock(ServicePool.class);
// Path: core/src/main/java/com/bazaarvoice/ostrich/HealthCheckResults.java
// public interface HealthCheckResults {
//     /**
//      * @return {@code true} if there is a healthy result, {@code false} otherwise.
//      */
//     boolean hasHealthyResult();
// 
//     /**
//      * @return All results in the aggregate, regardless of health.
//      */
//     Iterable<HealthCheckResult> getAllResults();
// 
//     /**
//      * Returns a healthy result if {@link #hasHealthyResult} is {@code true}. Returns {@code null} when
//      * {@code hasHealthyResult} is false. If there are multiple healthy results, there is no guarantee as to which gets
//      * returned.
//      * @return A result in the aggregate whose {@link HealthCheckResult#isHealthy} method returns {@code true}, or
//      * {@code null} if there are none.
//      */
//     HealthCheckResult getHealthyResult();
// 
//     /**
//      * @return Results in the aggregate whose {@link HealthCheckResult#isHealthy} method returns {@code false}.
//      */
//     Iterable<HealthCheckResult> getUnhealthyResults();
// }


// Path: core/src/test/java/com/bazaarvoice/ostrich/pool/ServicePoolProxiesTest.java
import com.bazaarvoice.ostrich.HealthCheckResults;
import com.bazaarvoice.ostrich.RetryPolicy;
import com.bazaarvoice.ostrich.ServicePool;
import com.google.common.reflect.Reflection;
import org.junit.Test;
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

        Service service = Reflection.newProxy(Service.class, mock(InvocationHandler.class));

        assertFalse(ServicePoolProxies.isProxy(service));
    }

    @Test
    public void testIsProxy() throws IOException {
        @SuppressWarnings("unchecked")
        Service service = ServicePoolProxy.create(Service.class, mock(RetryPolicy.class), mock(ServicePool.class),
                mock(PartitionContextSupplier.class), true);

        assertTrue(ServicePoolProxies.isProxy(service));
    }

    @Test
    public void testClose() throws IOException {
        @SuppressWarnings("unchecked")
        ServicePool<Service> pool = mock(ServicePool.class);
        Service service = ServicePoolProxy.create(Service.class, mock(RetryPolicy.class), pool,
                mock(PartitionContextSupplier.class), true);

        ServicePoolProxies.close(service);

        verify(pool).close();
    }

    @SuppressWarnings("unchecked")
    @Test
    public void testCheckForHealthyEndPoint() {
        ServicePool<Service> pool = mock(ServicePool.class);
        HealthCheckResults results = mock(HealthCheckResults.class);