@Test void defaultTagsEmpty() { Map<String, String> defaultTags = defaults.getDefaultTags(); Assertions.assertThat(defaultTags).isNotNull(); }
@Nonnull Map<String, String> getDefaultTags() { Function<String, String> evaluation = expression -> { if (expression == null) { return null; } Matcher matcher = ENV_PROPERTY.matcher(expression); if (matcher.matches()) { return System.getenv(matcher.group(2)); } matcher = SYSTEM_PROPERTY.matcher(expression); if (matcher.matches()) { return System.getProperty(matcher.group(2)); } return expression; }; return defaultTags .entrySet() .stream() .map(entry -> new String[]{entry.getKey(), evaluation.apply(entry.getValue())}) .filter(keyValue -> keyValue[1] != null) .collect(Collectors.toMap(keyValue -> keyValue[0], keyValue -> keyValue[1], (o, n) -> n, TreeMap::new)); }
PointSettings { @Nonnull Map<String, String> getDefaultTags() { Function<String, String> evaluation = expression -> { if (expression == null) { return null; } Matcher matcher = ENV_PROPERTY.matcher(expression); if (matcher.matches()) { return System.getenv(matcher.group(2)); } matcher = SYSTEM_PROPERTY.matcher(expression); if (matcher.matches()) { return System.getProperty(matcher.group(2)); } return expression; }; return defaultTags .entrySet() .stream() .map(entry -> new String[]{entry.getKey(), evaluation.apply(entry.getValue())}) .filter(keyValue -> keyValue[1] != null) .collect(Collectors.toMap(keyValue -> keyValue[0], keyValue -> keyValue[1], (o, n) -> n, TreeMap::new)); } }
PointSettings { @Nonnull Map<String, String> getDefaultTags() { Function<String, String> evaluation = expression -> { if (expression == null) { return null; } Matcher matcher = ENV_PROPERTY.matcher(expression); if (matcher.matches()) { return System.getenv(matcher.group(2)); } matcher = SYSTEM_PROPERTY.matcher(expression); if (matcher.matches()) { return System.getProperty(matcher.group(2)); } return expression; }; return defaultTags .entrySet() .stream() .map(entry -> new String[]{entry.getKey(), evaluation.apply(entry.getValue())}) .filter(keyValue -> keyValue[1] != null) .collect(Collectors.toMap(keyValue -> keyValue[0], keyValue -> keyValue[1], (o, n) -> n, TreeMap::new)); }  }
PointSettings { @Nonnull Map<String, String> getDefaultTags() { Function<String, String> evaluation = expression -> { if (expression == null) { return null; } Matcher matcher = ENV_PROPERTY.matcher(expression); if (matcher.matches()) { return System.getenv(matcher.group(2)); } matcher = SYSTEM_PROPERTY.matcher(expression); if (matcher.matches()) { return System.getProperty(matcher.group(2)); } return expression; }; return defaultTags .entrySet() .stream() .map(entry -> new String[]{entry.getKey(), evaluation.apply(entry.getValue())}) .filter(keyValue -> keyValue[1] != null) .collect(Collectors.toMap(keyValue -> keyValue[0], keyValue -> keyValue[1], (o, n) -> n, TreeMap::new)); }  @Nonnull PointSettings addDefaultTag(@Nonnull final String key,
                                       @Nullable final String expression); }
PointSettings { @Nonnull Map<String, String> getDefaultTags() { Function<String, String> evaluation = expression -> { if (expression == null) { return null; } Matcher matcher = ENV_PROPERTY.matcher(expression); if (matcher.matches()) { return System.getenv(matcher.group(2)); } matcher = SYSTEM_PROPERTY.matcher(expression); if (matcher.matches()) { return System.getProperty(matcher.group(2)); } return expression; }; return defaultTags .entrySet() .stream() .map(entry -> new String[]{entry.getKey(), evaluation.apply(entry.getValue())}) .filter(keyValue -> keyValue[1] != null) .collect(Collectors.toMap(keyValue -> keyValue[0], keyValue -> keyValue[1], (o, n) -> n, TreeMap::new)); }  @Nonnull PointSettings addDefaultTag(@Nonnull final String key,
                                       @Nullable final String expression);  }