### Question:
Metrics { public Metric percentile(String metricName, int percentile) { List<Metric> metric = metrics.get(metricName); if (metric == null || metrics.isEmpty()) { throw new IllegalArgumentException("Metric name not found: " + metricName); } List<Metric> list = new ArrayList<>(metric); list.sort(VALUE_COMPARATOR); int index = metric.size() * percentile / 100; return list.get(index); } Metrics(); void addMetric(Metric metric); void addMetric(String name, Number value); void addMetric(String name, Number value, String unit); boolean hasMetric(String name); List<Metric> getMetric(String name); Set<String> getMetricNames(); Metric latestMetric(String name); Metric percentile(String metricName, int percentile); double mean(String metricName);  }### Answer:
@Test(expectedExceptions = IllegalArgumentException.class) public void testPercentileException() { Metrics metrics = new Metrics(); metrics.percentile("not_found", 1); }