EnvironmentTagExtractor implements TagExtractor { @Override public Map<String, String> addTags(Map<String, String> tags) { final Map<String, String> extractedTags = new HashMap<>(tags); extractedTags.putAll(environmentTags); return extractedTags; } EnvironmentTagExtractor();  EnvironmentTagExtractor(Supplier<Map<String, String>> enviromentSupplier); @Override Map<String, String> addTags(Map<String, String> tags); static Map<String, String> filterEnvironmentTags(final Map<String, String> env); static final String FFWD_TAG_PREFIX; static Map<String, String> environmentTags; }
@Test public void testAddTags() { final Supplier<Map<String, String>> environmentSupplier = Suppliers.ofInstance(tags); final EnvironmentTagExtractor environmentTagExtractor = new EnvironmentTagExtractor(environmentSupplier); final Map<String, String> currentMap = ImmutableMap.of("cluster", "cluster1"); final Map<String, String> out = environmentTagExtractor.addTags(currentMap); assertEquals(ImmutableMap.of("foo", "bar", "bar", "baz", "cluster", "cluster1"), out); }