Class

work.martins.simon.expect.fluent

Expect

Related Doc: package fluent

Permalink

class Expect[R] extends Runnable[R] with Expectable[R]

Linear Supertypes
Expectable[R], Runnable[R], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Expect
  2. Expectable
  3. Runnable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Expect(command: String, defaultValue: R)

    Permalink
  2. new Expect(command: String, defaultValue: R, config: Config)

    Permalink
  3. new Expect(command: String, defaultValue: R, settings: Settings)

    Permalink
  4. new Expect(command: Seq[String], defaultValue: R, config: Config)

    Permalink
  5. new Expect(command: Seq[String], defaultValue: R, settings: Settings = new Settings())

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addExpectBlock(f: (Expect[R]) ⇒ Unit): Expect[R]

    Permalink

    Add arbitrary ExpectBlocks to this Expect.

    Add arbitrary ExpectBlocks to this Expect.

    This is helpful to refactor code. For example: imagine you have an error case you want to add to multiple expects. You could leverage this method to do so in the following way:

    def errorCaseExpectBlock(expect: Expect[String]): Unit {
      expect.expect
        .when("Some error")
          .returning("Got some error")
    }
    
    //Then in your expects
    def parseOutputA: Expect[String] = {
      val e = new Expect("some command", "")
      e.expect(...)
      e.expect
        .when(...)
          .action1
        .when(...)
          .action2
      e.addExpectBlock(errorCaseExpectBlock)
    }
    
    def parseOutputB: Expect[String] = {
      val e = new Expect("some command", "")
      e.expect
        .when(...)
          .action1
          .action2
        .when(...)
          .action1
      e.expect(...)
        .action2
      e.addExpectBlock(errorCaseExpectBlock)
    }
    f

    function that adds ExpectBlocks.

    returns

    this Expect.

    Definition Classes
    ExpectExpectable
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. val command: Seq[String]

    Permalink
  8. val defaultValue: R

    Permalink
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(other: Any): Boolean

    Permalink
    Definition Classes
    Expect → AnyRef → Any
  11. def expect: ExpectBlock[R]

    Permalink

    Adds an empty new ExpectBlock.

    Adds an empty new ExpectBlock.

    returns

    the new ExpectBlock.

    Definition Classes
    ExpectExpectable
  12. def expect(pattern: EndOfFile.type): EndOfFileWhen[R]

    Permalink

    Adds, in a new ExpectBlock, a EndOfFileWhen that matches whenever the end of file is reached while trying to read from the process output (stdOut).

    Adds, in a new ExpectBlock, a EndOfFileWhen that matches whenever the end of file is reached while trying to read from the process output (stdOut). This is a shortcut to expect.when(pattern).

    pattern

    the pattern to be used in the EndOfFileWhen.

    returns

    the new RegexWhen.

    Definition Classes
    Expectable
  13. def expect(pattern: Timeout.type): TimeoutWhen[R]

    Permalink

    Adds, in a new ExpectBlock, a TimeoutWhen that matches whenever the read from the process output (stdOut) times out.

    Adds, in a new ExpectBlock, a TimeoutWhen that matches whenever the read from the process output (stdOut) times out. This is a shortcut to expect.when(pattern).

    pattern

    the pattern to be used in the TimeoutWhen.

    returns

    the new RegexWhen.

    Definition Classes
    Expectable
  14. def expect(pattern: Regex): RegexWhen[R]

    Permalink

    Adds, in a new ExpectBlock, a RegexWhen that matches whenever the regex pattern successfully matches against the text read from the process output (stdOut).

    Adds, in a new ExpectBlock, a RegexWhen that matches whenever the regex pattern successfully matches against the text read from the process output (stdOut). This is a shortcut to expect.when(pattern).

    pattern

    the pattern to be used in the RegexWhen.

    returns

    the new RegexWhen.

    Definition Classes
    Expectable
  15. def expect(pattern: String): StringWhen[R]

    Permalink

    Adds, in a new ExpectBlock, a StringWhen that matches whenever pattern is contained in the text read from the process output (stdOut).

    Adds, in a new ExpectBlock, a StringWhen that matches whenever pattern is contained in the text read from the process output (stdOut). This is a shortcut to expect.when(pattern).

    pattern

    the pattern to be used in the StringWhen.

    returns

    the new StringWhen.

    Definition Classes
    Expectable
  16. val expectableParent: Expectable[R]

    Permalink
    Attributes
    protected
    Definition Classes
    ExpectExpectable
  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  19. def hashCode(): Int

    Permalink
    Definition Classes
    Expect → AnyRef → Any
  20. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. def run(timeout: FiniteDuration = timeout, charset: Charset = charset, bufferSize: Int = bufferSize, redirectStdErrToStdOut: Boolean = redirectStdErrToStdOut)(implicit ex: ExecutionContext): Future[R]

    Permalink

    Runs this Expect.

    Runs this Expect.

    timeout

    the maximum time to wait for each read.

    charset

    the charset to use when decoding/encoding the read/write text.

    bufferSize

    the size of the buffer to use when performing reads.

    redirectStdErrToStdOut

    whether to redirect the stdErr of the spawned process to the stdOut.

    ex

    the ExecutionContext upon which this Expect will be run.

    returns

    a Future with the value returned by a ReturningAction, if no ReturningAction exists defaultValue will be returned. If an exception occurred during the execution of the future then that exception will be returned in the Failure of the Future.

    Definition Classes
    ExpectRunnable
  25. val runnableParent: Runnable[R]

    Permalink
    Attributes
    protected
    Definition Classes
    ExpectRunnable
  26. val settings: Settings

    Permalink
    Definition Classes
    ExpectRunnable
  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  28. def toCore: core.Expect[R]

    Permalink

    returns

    the core.Expect equivalent of this fluent.Expect.

  29. def toString(): String

    Permalink
    Definition Classes
    Expect → AnyRef → Any
  30. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Expectable[R]

Inherited from Runnable[R]

Inherited from AnyRef

Inherited from Any

Ungrouped