DefaultHost implements Host { @Override public Stats stats() { return this.statistics; } DefaultHost(@NotNull final Bucket bckt);   DefaultHost(
        @NotNull final Bucket bckt,
        @NotNull final Host.CloudWatch cwatch
    ); @Override String toString(); @Override void close(); @Override @NotNull @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") @Loggable(value = Loggable.DEBUG, ignore = IOException.class) Resource fetch(@NotNull final URI uri,
        @NotNull final Range range, @NotNull final Version version); @Override boolean isHidden(@NotNull final URI uri); @Override boolean authorized(@NotNull final String user,
        @NotNull final String password); @Override String syslog(); @Override Stats stats();  }
@Test public void retrievesAndCachesCloudWatchStats() { final long sum = 10; final CloudWatch cloudwatch = this.cloudWatch(); final GetMetricStatisticsResult result = new GetMetricStatisticsResult() .withDatapoints(new Datapoint().withSum(Double.valueOf(sum))); Mockito.doReturn(result).when(cloudwatch.get()) .getMetricStatistics(Mockito.any(GetMetricStatisticsRequest.class)); MatcherAssert.assertThat( new DefaultHost( new BucketMocker().mock(), cloudwatch ).stats().bytesTransferred(), Matchers.allOf( Matchers.is(sum), Matchers.is( new DefaultHost( new BucketMocker().mock(), cloudwatch ).stats().bytesTransferred() ) ) ); Mockito.verify(cloudwatch.get(), Mockito.times(1)).getMetricStatistics( Mockito.any(GetMetricStatisticsRequest.class) ); }