MetricImporterUtils { public static void validExtraTags(Map<String, String> extraTags) { if (!extraTags.containsKey("app")) { throw new IllegalArgumentException("app tag in url is required"); } if (!extraTags.containsKey("step")) { throw new IllegalArgumentException("step tag in url is required"); } try { Integer.parseInt(extraTags.get("step")); } catch (NumberFormatException nfe) { throw new IllegalArgumentException("step tag in url is invalid"); } } private  MetricImporterUtils(); static void validExtraTags(Map<String, String> extraTags); static Metric mergeWithExtraTags(Metric metric, Map<String, String> extraTags); static void resolveExtraTagsFromURI(String baseURIPath, String requestURI,
                                               Map<String, String> map); static Map<String, String> resolveExtraTagsFromRequestHeaders(ServerRequest request,
                                                                         Map<String, String> map);  }
@Test public void testValidExtraTags() { Map<String, String> tags = new HashMap<>(); tags.put("app", "demo"); tags.put("step", "10000"); MetricImporterUtils.validExtraTags(tags); }
@Test(expected = IllegalArgumentException.class) public void testValidExtraTagsWithoutAppTag() { Map<String, String> tags = new HashMap<>(); tags.put("step", "10000"); MetricImporterUtils.validExtraTags(tags); }