Class MatcherFactory

java.lang.Object
com.codebarrel.automation.api.util.MatcherFactory

@Component public class MatcherFactory extends Object
  • Constructor Details

    • MatcherFactory

      @Inject public MatcherFactory(Clock clock, TenantService tenantService)
  • Method Details

    • timeoutMatcher

      public Matcher timeoutMatcher(@Nonnull Pattern pattern, @Nonnull CharSequence charSequence)
      Matcher instance that expires after the default timeout of 30 seconds (from when a matching function is called). WARNING: Matcher instance must be discarded afterwards to avoid another timing exception
      Parameters:
      pattern - Pattern to match against
      charSequence - Text
      Returns:
      Matcher that can throw MatcherTimeoutException if accessed after expiring, it must then be discarded (no re-use)
    • timeoutMatcher

      public Matcher timeoutMatcher(@Nonnull Pattern pattern, @Nonnull CharSequence charSequence, @Nonnull Duration timeout)
      Matcher instance that expires after the given timeout (from when a matching function is called). WARNING: Matcher instance must be discarded afterwards to avoid another timing exception
      Parameters:
      pattern - Pattern to match against
      charSequence - Text
      timeout - Expiry timeout duration
      Returns:
      Matcher that can throw MatcherTimeoutException if accessed after expiring, it must then be discarded (no re-use)