### Question:
CarbonConfigAdapter implements ConfigProvider { @Override public <T> T getConfigurationObject(Class<T> aClass) throws ConfigurationException { return getConfig(aClass.getCanonicalName(), aClass); } CarbonConfigAdapter(BrokerConfigProvider configProvider); @Override T getConfigurationObject(Class<T> aClass); @Override Object getConfigurationObject(String s); @Override T getConfigurationObject(String s, Class<T> aClass);  }### Answer:
@Test public void testGetConfigurationObject() throws Exception { CarbonConfigAdapter carbonConfigAdapter = new CarbonConfigAdapter(configProvider); TestConfig configurationObject = (TestConfig) carbonConfigAdapter.getConfigurationObject(TEST_CONFIG_NAMESPACE); Assert.assertEquals(configurationObject.getTestField(), NAMESPACE_KEY); }
@Test public void testGetConfigurationObject1() throws Exception { CarbonConfigAdapter carbonConfigAdapter = new CarbonConfigAdapter(configProvider); TestConfig configurationObject = carbonConfigAdapter.getConfigurationObject(TestConfig.class); Assert.assertEquals(configurationObject.getTestField(), CLASS_KEY); }
@Test public void testGetConfigurationObject2() throws Exception { CarbonConfigAdapter carbonConfigAdapter = new CarbonConfigAdapter(configProvider); TestConfig configurationObject = carbonConfigAdapter.getConfigurationObject(TEST_CONFIG_NAMESPACE, TestConfig.class); Assert.assertEquals(configurationObject.getTestField(), NAMESPACE_KEY); }
@Test(expectedExceptions = ConfigurationException.class) public void testGetInvalidConfigurationObject() throws Exception { CarbonConfigAdapter carbonConfigAdapter = new CarbonConfigAdapter(configProvider); TestConfig configurationObject = carbonConfigAdapter.getConfigurationObject("invalid.namespace", TestConfig.class); Assert.assertEquals(configurationObject.getTestField(), NAMESPACE_KEY); }