### Question:
StringUtils { @SuppressWarnings("unchecked") @NonNull public String applySubstitutionsToString(@NonNull final String string, @NonNull final Pair<String, String>... substitutions) { String primaryString = string; for (final Pair<String, String> substitution : substitutions) { primaryString = primaryString.replace("{{" + substitution.first + "}}", substitution.second); } return primaryString; } @Inject  StringUtils(); @SuppressWarnings("unchecked") @NonNull String applySubstitutionsToString(@NonNull final String string, @NonNull final Pair<String, String>... substitutions);  }### Answer:
@Test public void parametersAreReplacedCorrectly() { String param1Name = "firstName"; String param1Value = "Georgy"; String param2Name = "lastName"; String param2Value = "Georgiev"; String string = "He is {{firstName}} {{lastName}}"; String formattedString = stringUtils.applySubstitutionsToString(string, Pair.create(param1Name, param1Value), Pair.create(param2Name, param2Value)); assertThat(formattedString).isEqualTo("He is Georgy Georgiev"); }
@Test public void notFoundParametersAreIgnored() { String param1Name = "wrongParamName"; String param1Value = "Somebody"; String string = "He is {{firstName}}"; String formattedString = stringUtils.applySubstitutionsToString(string, Pair.create(param1Name, param1Value)); assertThat(formattedString).isEqualTo(string); }