CachingClientProvider implements ClientProvider { public CachingClientProvider(@Value("${fullstop.stsRegion:#{null}") String stsRegion) { this.stsRegion = stsRegion; } CachingClientProvider(@Value("${fullstop.stsRegion:#{null}") String stsRegion); @Override T getClient(final Class<T> type, final String accountId, final Region region); @PostConstruct void init(); @PreDestroy void tearDown();  }
@Test public void testCachingClientProvider() { final AmazonEC2Client client = provider.getClient(AmazonEC2Client.class, ACCOUNT_ID1, REGION1); assertThat(client).isNotNull(); assertThat(provider.getClient(AmazonEC2Client.class, ACCOUNT_ID1, REGION1)) .isNotNull() .isSameAs(client); assertThat(provider.getClient(AmazonEC2Client.class, ACCOUNT_ID2, REGION1)) .isNotNull() .isNotSameAs(client); assertThat(provider.getClient(AmazonEC2Client.class, ACCOUNT_ID1, REGION2)) .isNotNull() .isNotSameAs(client); assertThat(provider.getClient(AmazonCloudWatchClient.class, ACCOUNT_ID1, REGION1)) .isNotNull() .isNotSameAs(client); }