### Question:
MetricsPaddingRenderer extends DefaultRenderer { @Override public TreeNode<Set<String>> finalizeProperties(TreeNode<QueryInfo> queryProperties, boolean isCollection) { Set<String> properties = queryProperties.getObject().getProperties(); if (properties != null) { properties.add("params/padding/" + paddingMethod.name()); } return super.finalizeProperties(queryProperties, isCollection); } MetricsPaddingRenderer(String paddingMethod); @Override TreeNode<Set<String>> finalizeProperties(TreeNode<QueryInfo> queryProperties,
                                                  boolean isCollection);  }### Answer:
@Test public void testFinalizeProperties__NullPadding_property() { SchemaFactory schemaFactory = createNiceMock(SchemaFactory.class); Schema schema = createNiceMock(Schema.class); expect(schemaFactory.getSchema(Resource.Type.Service)).andReturn(schema).anyTimes(); expect(schema.getKeyPropertyId(Resource.Type.Service)).andReturn("ServiceInfo/service_name").anyTimes(); expect(schema.getKeyPropertyId(Resource.Type.Cluster)).andReturn("ServiceInfo/cluster_name").anyTimes(); replay(schemaFactory, schema); HashSet<String> serviceProperties = new HashSet<>(); serviceProperties.add("foo/bar"); QueryInfo rootQuery = new QueryInfo(new ServiceResourceDefinition(), serviceProperties); TreeNode<QueryInfo> queryTree = new TreeNodeImpl<>(null, rootQuery, "Service"); MetricsPaddingRenderer renderer = new MetricsPaddingRenderer("null_padding"); renderer.init(schemaFactory); TreeNode<Set<String>> propertyTree = renderer.finalizeProperties(queryTree, false); assertEquals(4, propertyTree.getObject().size()); assertTrue(propertyTree.getObject().contains("ServiceInfo/service_name")); assertTrue(propertyTree.getObject().contains("ServiceInfo/cluster_name")); assertTrue(propertyTree.getObject().contains("foo/bar")); assertTrue(propertyTree.getObject().contains("params/padding/NULLS")); assertEquals(0, propertyTree.getChildren().size()); verify(schemaFactory, schema); }