@Test
    public void testLoadBalancerHappyCase() throws Exception {
        Assert.assertNotEquals("the two test server list counts should be different",
                secondServerListSize, initialServerListSize);

        DynamicServerListLoadBalancer<DiscoveryEnabledServer> lb = null;
        try {
            Capture<EurekaEventListener> eventListenerCapture = new Capture<EurekaEventListener>();
            eurekaClientMock.registerEventListener(EasyMock.capture(eventListenerCapture));

            PowerMock.replay(DiscoveryClient.class);
            PowerMock.replay(eurekaClientMock);

            // actual testing
            // initial creation and loading of the first serverlist
            lb = new DynamicServerListLoadBalancer<DiscoveryEnabledServer>(
                    config,
                    new AvailabilityFilteringRule(),
                    new DummyPing(),
                    new DiscoveryEnabledNIWSServerList(vipAddress, eurekaClientProvider),
                    new ZoneAffinityServerListFilter<DiscoveryEnabledServer>(),
                    new EurekaNotificationServerListUpdater(eurekaClientProvider)
            );

            Assert.assertEquals(initialServerListSize, lb.getServerCount(false));

            // trigger an eureka CacheRefreshEvent
            eventListenerCapture.getValue().onEvent(new CacheRefreshedEvent());

            Assert.assertTrue(verifyFinalServerListCount(secondServerListSize, lb));

        } finally {
            if (lb != null) {
                lb.shutdown();

                PowerMock.verify(eurekaClientMock);
                PowerMock.verify(DiscoveryClient.class);
            }
        }
    }
A test for {@link com.netflix.loadbalancer.DynamicServerListLoadBalancer} using the
{@link com.netflix.niws.loadbalancer.EurekaNotificationServerListUpdater} instead of the default.

@author David Liu
ribbon-eureka/src/test/java/com/netflix/loadbalancer/EurekaDynamicServerListLoadBalancerTest.java