CloudConfigurationProviderImpl implements CloudConfigurationProvider { public Cloud getCloud(String cloudId) { if (!cloudsMap.containsKey(cloudId)) { throw new IllegalArgumentException(String.format("Cloud with id = %s does not exist", cloudId)); } return cloudsMap.get(cloudId); } @Autowired  CloudConfigurationProviderImpl(Config config); @PostConstruct void init(); Cloud getCloud(String cloudId); Collection<Cloud> getClouds();  }
@Test public void testGetCloud() throws Exception { Cloud cloud = cloudConfigurationProvider.getCloud("test-id"); assertThat(cloud, equalTo(CLOUD)); }
@Test(expected = IllegalArgumentException.class) public void testGetCloudWithMissingId() throws Exception { cloudConfigurationProvider.getCloud("missing-id"); }