StaticHttpServiceBalancerFactory { HttpServiceBalancer createHttpServiceBalancer(String type, StaticHttpServiceConfig staticHttpServiceConfig, HttpServiceBalancerConfig balancerConfig) { requireNonNull(type, "type is null"); requireNonNull(balancerConfig, "balancerConfig is null"); Map<String, String> tags = ImmutableMap.of("serviceType", type); HttpServiceBalancerStats httpServiceBalancerStats = reportCollectionFactory.createReportCollection(HttpServiceBalancerStats.class, false, "ServiceClient", tags); HttpServiceBalancerImpl balancer = new HttpServiceBalancerImpl(format("type=[%s]", type), httpServiceBalancerStats, balancerConfig); balancer.updateHttpUris(staticHttpServiceConfig.getUris()); reportExporter.export(balancer, false, "ServiceClient", tags); return balancer; } @Inject  StaticHttpServiceBalancerFactory(
            ReportExporter reportExporter,
            ReportCollectionFactory reportCollectionFactory);   }
@Test public void testCreateBalancer() { ReportExporter reportExporter = mock(ReportExporter.class); ReportCollectionFactory reportCollectionFactory = new ReportCollectionFactory(reportExporter); StaticHttpServiceBalancerFactory factory = new StaticHttpServiceBalancerFactory(reportExporter, reportCollectionFactory); HttpServiceBalancer balancer = factory.createHttpServiceBalancer( "foo", new StaticHttpServiceConfig().setUris(UriMultiset.valueOf("http: new HttpServiceBalancerConfig()); HttpServiceAttempt attempt = balancer.createAttempt(); assertEquals(attempt.getUri(), URI.create("http: attempt.markGood(); verify(reportExporter).export(balancer, false, "ServiceClient", ImmutableMap.of("serviceType", "foo")); ArgumentCaptor<SparseTimeStat> statsCaptor = ArgumentCaptor.forClass(SparseTimeStat.class); verify(reportExporter).export(statsCaptor.capture(), eq(false), eq("ServiceClient.RequestTime"), eq(ImmutableMap.of("serviceType", "foo", "targetUri", "http: verifyNoMoreInteractions(reportExporter); }