### Question:
MetricUtils { protected static void pushDownPredicate(Constraints constraints, ListMetricsRequest listMetricsRequest) { Map<String, ValueSet> summary = constraints.getSummary(); ValueSet namespaceConstraint = summary.get(NAMESPACE_FIELD); if (namespaceConstraint != null && namespaceConstraint.isSingleValue()) { listMetricsRequest.setNamespace(namespaceConstraint.getSingleValue().toString()); } ValueSet metricConstraint = summary.get(METRIC_NAME_FIELD); if (metricConstraint != null && metricConstraint.isSingleValue()) { listMetricsRequest.setMetricName(metricConstraint.getSingleValue().toString()); } ValueSet dimensionNameConstraint = summary.get(DIMENSION_NAME_FIELD); ValueSet dimensionValueConstraint = summary.get(DIMENSION_VALUE_FIELD); if (dimensionNameConstraint != null && dimensionNameConstraint.isSingleValue() && dimensionValueConstraint != null && dimensionValueConstraint.isSingleValue()) { DimensionFilter filter = new DimensionFilter() .withName(dimensionNameConstraint.getSingleValue().toString()) .withValue(dimensionValueConstraint.getSingleValue().toString()); listMetricsRequest.setDimensions(Collections.singletonList(filter)); } } private  MetricUtils();   }### Answer:
@Test public void pushDownPredicate() { Map<String, ValueSet> constraintsMap = new HashMap<>(); constraintsMap.put(NAMESPACE_FIELD, makeStringEquals(allocator, "match1")); constraintsMap.put(METRIC_NAME_FIELD, makeStringEquals(allocator, "match2")); constraintsMap.put(STATISTIC_FIELD, makeStringEquals(allocator, "match3")); constraintsMap.put(DIMENSION_NAME_FIELD, makeStringEquals(allocator, "match4")); constraintsMap.put(DIMENSION_VALUE_FIELD, makeStringEquals(allocator, "match5")); ListMetricsRequest request = new ListMetricsRequest(); MetricUtils.pushDownPredicate(new Constraints(constraintsMap), request); assertEquals("match1", request.getNamespace()); assertEquals("match2", request.getMetricName()); assertEquals(1, request.getDimensions().size()); assertEquals(new DimensionFilter().withName("match4").withValue("match5"), request.getDimensions().get(0)); }