### Question:
WrappedTagReplacer { public List<T> getAdaptedItems(A argument) { List<String> adaptedStrings = tagReplacer.getAdaptedMessages(argument); List<T> adaptedItems = new LinkedList<>(); Iterator<T> originalItemsIter = items.iterator(); Iterator<String> newStringsIter = adaptedStrings.iterator(); while (originalItemsIter.hasNext() && newStringsIter.hasNext()) { adaptedItems.add(itemCreator.apply(originalItemsIter.next(), newStringsIter.next())); } return adaptedItems; } WrappedTagReplacer(Collection<Tag<A>> allTags,
                              Collection<T> items,
                              Function<? super T, String> stringGetter,
                              BiFunction<T, String, ? extends T> itemCreator); List<T> getAdaptedItems(A argument);  }### Answer:
@Test public void shouldApplyTags() { TestTagService tagService = new TestTagService(); List<Tag<Integer>> tags = tagService.getAvailableTags(); List<SampleClass> objects = Arrays.asList( new SampleClass(3, "pi is %PI"), new SampleClass(5, "no tags here"), new SampleClass(7, "i+i = %double")); WrappedTagReplacer<SampleClass, Integer> replacer = new WrappedTagReplacer<>( tags, objects, SampleClass::getDescription, (o, s) -> new SampleClass(o.number, s)); List<SampleClass> result1 = replacer.getAdaptedItems(8); List<SampleClass> result2 = replacer.getAdaptedItems(1); assertThat(tagService.piCount, equalTo(2)); assertThat(tagService.selfCount, equalTo(0)); assertThat(tagService.doubleCount, equalTo(2)); assertThat(tagService.squareCount, equalTo(0)); assertThat(result1, contains( sampleClass(3, "pi is 3.14159"), sampleClass(5, "no tags here"), sampleClass(7, "i+i = 16"))); assertThat(result2, contains( sampleClass(3, "pi is 3.14159"), sampleClass(5, "no tags here"), sampleClass(7, "i+i = 2"))); }