### Question:
AbstractPropertyProvider extends BaseProvider implements PropertyProvider { protected Map<String, PropertyInfo> getPropertyInfoMap(String componentName, String propertyId) { Map<String, PropertyInfo> propertyInfoMap = new HashMap<>(); updatePropertyInfoMap(componentName, propertyId, propertyInfoMap); return propertyInfoMap; } AbstractPropertyProvider(Map<String, Map<String, PropertyInfo>> componentMetrics); Map<String, Map<String, PropertyInfo>> getComponentMetrics();  }### Answer:
@Test public void testGetPropertyInfoMap() { AbstractPropertyProvider provider = new TestPropertyProvider(PropertyHelper.getMetricPropertyIds(Resource.Type.HostComponent)); Map<String, PropertyInfo> propertyInfoMap = provider.getPropertyInfoMap("NAMENODE", "metrics/cpu/cpu_aidle"); Assert.assertEquals(1, propertyInfoMap.size()); Assert.assertTrue(propertyInfoMap.containsKey("metrics/cpu/cpu_aidle")); propertyInfoMap = provider.getPropertyInfoMap("NAMENODE", "metrics/disk"); Assert.assertEquals(3, propertyInfoMap.size()); Assert.assertTrue(propertyInfoMap.containsKey("metrics/disk/disk_free")); Assert.assertTrue(propertyInfoMap.containsKey("metrics/disk/disk_total")); Assert.assertTrue(propertyInfoMap.containsKey("metrics/disk/part_max_used")); }
@Test public void testGetJMXPropertyInfoMap() { AbstractPropertyProvider provider = new TestPropertyProvider( PropertyHelper.getJMXPropertyIds(Resource.Type.HostComponent)); Map<String, PropertyInfo> propertyInfoMap = provider.getPropertyInfoMap("DATANODE", "metrics"); Assert.assertEquals(86, propertyInfoMap.size()); propertyInfoMap = provider.getPropertyInfoMap("DATANODE", "metrics/rpc/RpcQueueTime_avg_time"); Assert.assertEquals(1, propertyInfoMap.size()); Assert.assertTrue(propertyInfoMap.containsKey("metrics/rpc/RpcQueueTime_avg_time")); propertyInfoMap = provider.getPropertyInfoMap("DATANODE", "metrics/rpc/"); Assert.assertEquals(12, propertyInfoMap.size()); Assert.assertTrue(propertyInfoMap.containsKey("metrics/rpc/RpcQueueTime_avg_time")); }