private Predicate<String> getPredicate(ExpectedException annotation) {
    if (has(annotation.messageStartsWith())) {
      return s -> s.startsWith(annotation.messageStartsWith());
    } else if (has(annotation.messageContains())) {
      return s -> s.contains(annotation.messageContains());
    } else if (has(annotation.messageIs())) {
      return s -> s.equals(annotation.messageIs());
    } else {
      // the default
      return s -> true;
    }
  }
private Predicate<String> getPredicate(ExpectedException annotation) {
    if (has(annotation.messageStartsWith())) {
      return s -> s.startsWith(annotation.messageStartsWith());
    } else if (has(annotation.messageContains())) {
      return s -> s.contains(annotation.messageContains());
    } else if (has(annotation.messageIs())) {
      return s -> s.equals(annotation.messageIs());
    } else {
      
      return s -> true;
    }
  }
private Predicate < String > getPredicate ( ExpectedException annotation ) { if ( has ( annotation . messageStartsWith ( ) ) ) { return s -> s . startsWith ( annotation . messageStartsWith ( ) ) ; } else if ( has ( annotation . messageContains ( ) ) ) { return s -> s . contains ( annotation . messageContains ( ) ) ; } else if ( has ( annotation . messageIs ( ) ) ) { return s -> s . equals ( annotation . messageIs ( ) ) ; } else { // the default return s -> true ; } }
Maps the expectations expressed in the given {@code annotation} to a {@link Predicate}.

@param annotation encapsulates the callers' expression of what's to be deemed an acceptable
exception
@return a predicate which can be used to assess whether an exception matches the expectations
expressed in the given {@code annotation}
Maps the expectations expressed in the given { @code annotation } to a { @link Predicate } .