### Question:
ClusterImpl implements Cluster { @Override public String getConfigurationValue(String type, String key) { Config config = cluster.getDesiredConfigByType(type); return config == null ? null : config.getProperties().get(key); } ClusterImpl(org.apache.ambari.server.state.Cluster cluster); @Override String getName(); @Override String getConfigurationValue(String type, String key); @Override Map<String, String> getConfigByType(String type); @Override List<String> getHostsForServiceComponent(String serviceName, String componentName);  }### Answer:
@Test public void testGetConfigurationValue() throws Exception { Cluster cluster = createNiceMock(Cluster.class); Config config = createNiceMock(Config.class); Map<String, String> properties = new HashMap<>(); properties.put("foo", "bar"); expect(cluster.getDesiredConfigByType("core-site")).andReturn(config).anyTimes(); expect(config.getProperties()).andReturn(properties).anyTimes(); replay(cluster, config); ClusterImpl clusterImpl = new ClusterImpl(cluster); Assert.assertEquals("bar", clusterImpl.getConfigurationValue("core-site", "foo")); verify(cluster, config); }