@@ -0,0 +1,2295 @@
+/*%0A * #%25L%0A * wcm.io%0A * %25%25%0A * Copyright (C) 2020 wcm.io%0A * %25%25%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * #L%25%0A */%0Apackage io.wcm.qa.glnm.hamcrest;%0A%0Aimport java.util.function.Function;%0A%0Aimport org.hamcrest.Description;%0Aimport org.hamcrest.Matcher;%0A%0A/**%0A * %3Cp%3EFunctionalWrappingMatcher class.%3C/p%3E%0A *%0A * @since 5.0.0%0A */%0Apublic class FunctionalWrappingMatcher%3CT, M%3E extends TypeSafeWrappingMatcher%3CT, M%3E %7B%0A%0A  private Function%3CT, M%3E mappingFunction;%0A%0A  protected FunctionalWrappingMatcher(Function%3CT, M%3E mapping, Matcher%3CM%3E matcher) %7B%0A    super(matcher);%0A    setMappingFunction(mapping);%0A  %7D%0A%0A  /** %7B@inheritDoc%7D */%0A  @Override%0A  public void describeTo(Description description) %7B%0A    description.appendText(%22when mapping %22);%0A    super.describeTo(description);%0A  %7D%0A%0A  @Override%0A  protected M map(T item) %7B%0A    return getMappingFunction().apply(item);%0A  %7D%0A%0A  /**%0A   * %3Cp%3EGetter for the field %3Ccode%3EmappingFunction%3C/code%3E.%3C/p%3E%0A   *%0A   * @return a %7B@link java.util.function.Function%7D object.%0A   */%0A  public Function%3CT, M%3E getMappingFunction() %7B%0A    return mappingFunction;%0A  %7D%0A%0A  /**%0A   * %3Cp%3ESetter for the field %3Ccode%3EmappingFunction%3C/code%3E.%3C/p%3E%0A   *%0A   * @param mappingFunction a %7B@link java.util.function.Function%7D object.%0A   */%0A  public void setMappingFunction(Function%3CT, M%3E mappingFunction) %7B%0A    this.mappingFunction = mappingFunction;%0A  %7D%0A%0A  /**%0A   * Maps input to type needed and then matches.%0A   *%0A   * @param %3CT%3E input type%0A   * @param %3CM%3E type needed by matcher%0A   * @param mapping used to map input to matcher type%0A   * @param matcher used to do actual matching%0A   * @return matcher that maps and matches%0A   */%0A  public static %3CT, M%3E Matcher%3CT%3E whenMapping(Function%3CT, M%3E mapping, Matcher%3CM%3E matcher) %7B%0A    return new FunctionalWrappingMatcher%3CT, M%3E(mapping, matcher);%0A  %7D%0A%0A%7D%0A

add generic mapping matcher