All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mockito.matchers.StringThatMatchers.scala Maven / Gradle / Ivy

The newest version!
package org.mockito.matchers

private[mockito] trait StringThatMatchers {
  import ThatMatchers.argThat

  /**
   * Delegates to ArgumentMatchers.matches(), it's only here so we expose all the `ArgumentMatchers` on a single place
   */
  def matches(regex: String): String = argThat((s: String) => s.matches(regex), s"matches($regex)")

  /**
   * Delegates to ArgumentMatchers.startsWith(), it's only here so we expose all the `ArgumentMatchers` on a single place
   */
  def startsWith(prefix: String): String = argThat((s: String) => s.startsWith(prefix), s"startsWith($prefix)")

  /**
   * Delegates to ArgumentMatchers.contains(), it's only here so we expose all the `ArgumentMatchers` on a single place
   */
  def contains(substring: String): String = argThat((s: String) => s.contains(substring), s"contains($substring)")

  /**
   * Delegates to ArgumentMatchers.endsWith(), it's only here so we expose all the `ArgumentMatchers` on a single place
   */
  def endsWith(suffix: String): String = argThat((s: String) => s.endsWith(suffix), s"endsWith($suffix)")
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy