case class RegexWhen[R](parent: ExpectBlock[R], pattern: Regex, readFrom: FromInputStream = StdOut) extends When[R] with Product with Serializable
- Alphabetic
- By Inheritance
- RegexWhen
- Serializable
- Serializable
- Product
- Equals
- When
- Whenable
- Expectable
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
-  new RegexWhen(parent: ExpectBlock[R], pattern: Regex, readFrom: FromInputStream = StdOut)
Type Members
- 
      
      
      
        
      
    
      
        
        type
      
      
        CW[+X] = core.RegexWhen[X]
      
      
      The concrete core.When type constructor which this fluent.When is a builder for. 
- 
      
      
      
        
      
    
      
        
        type
      
      
        This[X] = RegexWhen[X]
      
      
      The concrete When type constructor to which the actions will be applied. 
Value Members
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        !=(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ##(): Int
      
      
      - Definition Classes
- AnyRef → Any
 
-  def +(other: String): String
-  def ->[B](y: B): (RegexWhen[R], B)
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ==(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        val
      
      
        actions: Seq[Action[R, CW]]
      
      
      - Attributes
- protected
- Definition Classes
- When
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        addActions(f: (This[R]) ⇒ Unit): This[R]
      
      
      Add arbitrary Actions to thisWhen.Add arbitrary Actions to thisWhen.This is helpful to refactor code. For example: imagine you want to perform the same actions whenever an error occurs. You could leverage this method to do so in the following way: def preemtiveExit(when: When[String]): Unit { when .returning("Got some error") .exit() } def parseOutputA: Expect[String] = { val e = new Expect("some command", "") e.expect .when(...) .action1 .when(...) .addActions(preemtiveExit) } def parseOutputB: Expect[String] = { val e = new Expect("some command", "") e.expect(...) .addActions(preemtiveExit) } - f
- function that adds - Actions.
- returns
- this - When.
 - Definition Classes
- When
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        addExpectBlock(f: (Expect[R]) ⇒ Unit): Expect[R]
      
      
      Add arbitrary ExpectBlocks to thisExpect.Add arbitrary ExpectBlocks to thisExpect.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
- Expectable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        addWhen[W <: When[R]](f: (ExpectBlock[R]) ⇒ W): W
      
      
      Add an arbitrary Whento thisExpectBlock.Add an arbitrary Whento thisExpectBlock.This is helpful to refactor code. For example: imagine you have an error case you want to add to multiple ExpectBlocks. You could leverage this method to do so in the following way:def errorCaseWhen(expectBlock: ExpectBlock[String]): When[String] = { expectBlock .when("Some error") .returning("Got some error") } def parseOutputA: Expect[String] = { val e = new Expect("some command", "") e.expect .when(...) .sendln(...) e.expect .addWhen(errorCaseWhen) .exit() } def parseOutputB: Expect[String] = { val e = new Expect("some command", "") e.expect .when(...) .sendln(..) .returning(...) .addWhen(errorCaseWhen) } This function returns the added When which allows you to add further actions, see the exit action of the parseOutputAmethod in the above code.It is possible to add more than one When using this method, however this is discouraged since it will make the code somewhat more illegible because "hidden" Whens will also be added. If you need to add more than one When you have two options: e.expect .when(...) .sendln(..) .returning(...) .addWhen(errorCaseWhen) .addWhen(anotherWhen)e.expect .when(...) .sendln(..) .returning(...) .addWhens(multipleWhens)- f
- function that adds the - When.
- returns
- the added - When.
 - Definition Classes
- Whenable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        addWhens(f: (ExpectBlock[R]) ⇒ Unit): ExpectBlock[R]
      
      
      Add arbitrary Whens to thisExpectBlock.Add arbitrary Whens to thisExpectBlock.This method is very similar to the addWhenwith the following differences:- fhas a more relaxed type.
- It returns this ExpectBlock. Which effectively prohibits you from invoking When methods.
- Has a more semantic name when it comes to adding multiple When's.
 - f
- function that adds - Whens.
- returns
- this ExpectBlock. 
 - Definition Classes
- Whenable
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        asInstanceOf[T0]: T0
      
      
      - Definition Classes
- Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        clone(): AnyRef
      
      
      - Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
 
-  def ensuring(cond: (RegexWhen[R]) ⇒ Boolean, msg: ⇒ Any): RegexWhen[R]
-  def ensuring(cond: (RegexWhen[R]) ⇒ Boolean): RegexWhen[R]
-  def ensuring(cond: Boolean, msg: ⇒ Any): RegexWhen[R]
-  def ensuring(cond: Boolean): RegexWhen[R]
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        eq(arg0: AnyRef): Boolean
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        equals(other: Any): Boolean
      
      
      - Definition Classes
- RegexWhen → Equals → AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        exit(): This[R]
      
      
      Terminates the current run of Expect causing it to return the last returned value. Terminates the current run of Expect causing it to return the last returned value. Any action or expect block added after this Exit will not be executed. - returns
- this When. 
 - Definition Classes
- When
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        expect(pattern: Timeout.type): TimeoutWhen[R]
      
      
      Adds, in a new ExpectBlock, aTimeoutWhenthat matches whenever the read from any of theFromStreamInputs times out.Adds, in a new ExpectBlock, aTimeoutWhenthat matches whenever the read from any of theFromStreamInputs times out. This is a shortcut toexpect.when(pattern).- pattern
- the pattern to be used in the - TimeoutWhen.
- returns
- the new - RegexWhen.
 - Definition Classes
- Expectable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        expect(pattern: EndOfFile.type, readFrom: FromInputStream): EndOfFileWhen[R]
      
      
      Adds, in a new ExpectBlock, aEndOfFileWhenthat matches whenever the end of file is reached while trying to read from the specifiedFromInputStream.Adds, in a new ExpectBlock, aEndOfFileWhenthat matches whenever the end of file is reached while trying to read from the specifiedFromInputStream. This is a shortcut toexpect.when(pattern, readFrom).- pattern
- the pattern to be used in the - EndOfFileWhen.
- readFrom
- from which - FromInputStreamto read the output.
- returns
- the new - RegexWhen.
 - Definition Classes
- Expectable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        expect(pattern: EndOfFile.type): EndOfFileWhen[R]
      
      
      Adds, in a new ExpectBlock, aEndOfFileWhenthat matches whenever the end of file is reached while trying to read from the StdOut output.Adds, in a new ExpectBlock, aEndOfFileWhenthat matches whenever the end of file is reached while trying to read from the StdOut output. This is a shortcut toexpect.when(pattern).- pattern
- the pattern to be used in the - EndOfFileWhen.
- returns
- the new - RegexWhen.
 - Definition Classes
- Expectable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        expect(pattern: Regex, readFrom: FromInputStream): RegexWhen[R]
      
      
      Adds, in a new ExpectBlock, aRegexWhenthat matches whenever the regexpatternsuccessfully matches against the text read from the specifiedFromInputStream.Adds, in a new ExpectBlock, aRegexWhenthat matches whenever the regexpatternsuccessfully matches against the text read from the specifiedFromInputStream. This is a shortcut toexpect.when(pattern, readFrom).- pattern
- the pattern to be used in the - RegexWhen.
- readFrom
- from which - FromInputStreamto read the output.
- returns
- the new - RegexWhen.
 - Definition Classes
- Expectable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        expect(pattern: Regex): RegexWhen[R]
      
      
      Adds, in a new ExpectBlock, aRegexWhenthat matches whenever the regexpatternsuccessfully matches against the text read from the StdOut output.Adds, in a new ExpectBlock, aRegexWhenthat matches whenever the regexpatternsuccessfully matches against the text read from the StdOut output. This is a shortcut toexpect.when(pattern).- pattern
- the pattern to be used in the - RegexWhen.
- returns
- the new - RegexWhen.
 - Definition Classes
- Expectable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        expect(pattern: String, readFrom: FromInputStream): StringWhen[R]
      
      
      Adds, in a new ExpectBlock, aStringWhenthat matches wheneverpatternis contained in the text read from the specifiedFromInputStream.Adds, in a new ExpectBlock, aStringWhenthat matches wheneverpatternis contained in the text read from the specifiedFromInputStream. This is a shortcut toexpect.when(pattern, readFrom).- pattern
- the pattern to be used in the - StringWhen.
- readFrom
- from which - FromInputStreamto read the output.
- returns
- the new - StringWhen.
 - Definition Classes
- Expectable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        expect(pattern: String): StringWhen[R]
      
      
      Adds, in a new ExpectBlock, aStringWhenthat matches wheneverpatternis contained in the text read from the StdOut output.Adds, in a new ExpectBlock, aStringWhenthat matches wheneverpatternis contained in the text read from the StdOut output. This is a shortcut toexpect.when(pattern).- pattern
- the pattern to be used in the - StringWhen.
- returns
- the new - StringWhen.
 - Definition Classes
- Expectable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        expect(readFrom: FromInputStream): ExpectBlock[R]
      
      
      Adds an empty new ExpectBlockreading from the specifiedFromInputStream.Adds an empty new ExpectBlockreading from the specifiedFromInputStream.- readFrom
- from which - FromInputStreamto read the output.
- returns
- the new - ExpectBlock.
 - Definition Classes
- Expectable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        expect: ExpectBlock[R]
      
      
      Adds an empty new ExpectBlock.
- 
      
      
      
        
      
    
      
        
        lazy val
      
      
        expectableParent: Expect[R]
      
      
      - Attributes
- protected
- Definition Classes
- Whenable → Expectable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        finalize(): Unit
      
      
      - Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
 
-  def formatted(fmtstr: String): String
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        getClass(): Class[_]
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        hashCode(): Int
      
      
      - Definition Classes
- RegexWhen → AnyRef → Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        isInstanceOf[T0]: Boolean
      
      
      - Definition Classes
- Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ne(arg0: AnyRef): Boolean
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        newAction(action: Action[R, CW]): This[R]
      
      
      - Attributes
- protected
- Definition Classes
- When
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        notify(): Unit
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        notifyAll(): Unit
      
      
      - Definition Classes
- AnyRef
 
-  val parent: ExpectBlock[R]
-  val pattern: Regex
-  val readFrom: FromInputStream
- 
      
      
      
        
      
    
      
        
        def
      
      
        returning(result: (Match) ⇒ R): RegexWhen[R]
      
      
      Returns the result of invoking resultwith theMatchof the regex used, when this Expect is run.Returns the result of invoking resultwith theMatchof the regex used, when this Expect is run. If this method is invoked more than once only the lastresultwill be returned. Note however that the previous returning actions will also be executed.- returns
- this When. 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        returning(result: ⇒ R): This[R]
      
      
      Returns resultwhen this Expect is run.Returns resultwhen this Expect is run. If this method is invoked more than once only the lastresultwill be returned. Note however that the previous returning actions will also be executed.- returns
- this When. 
 - Definition Classes
- When
 
-  def returningExpect(result: (Match) ⇒ core.Expect[R]): RegexWhen[R]
- 
      
      
      
        
      
    
      
        
        def
      
      
        returningExpect(result: ⇒ core.Expect[R]): This[R]
      
      
      - Definition Classes
- When
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        send(text: (Match) ⇒ String): RegexWhen[R]
      
      
      Send the result of invoking textwith theMatchof the regex used, to the stdIn of the underlying process.Send the result of invoking textwith theMatchof the regex used, to the stdIn of the underlying process. Send will only occur when Expect is run.- returns
- this When. 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        send(text: String, sensitive: Boolean = false): This[R]
      
      
      Send textto the stdIn of the underlying process.Send textto the stdIn of the underlying process. Send will only occur when Expect is run.- returns
- this When. 
 - Definition Classes
- When
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendln(text: (Match) ⇒ String): RegexWhen[R]
      
      
      Send the result of invoking textwith theMatchof the regex used with aSystem.lineSeparator()appended to the end, to the stdIn of the underlying process.Send the result of invoking textwith theMatchof the regex used with aSystem.lineSeparator()appended to the end, to the stdIn of the underlying process. Send will only occur when Expect is run.- returns
- this When. 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendln(text: String, sensitive: Boolean = false): This[R]
      
      
      Sends textterminated withSystem.lineSeparator()to the stdIn of the underlying process.Sends textterminated withSystem.lineSeparator()to the stdIn of the underlying process. Send will only occur when Expect is run.- returns
- this When. 
 - Definition Classes
- When
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        synchronized[T0](arg0: ⇒ T0): T0
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        
        val
      
      
        thisSubtype: This[R]
      
      
      - Definition Classes
- When
 
-  def toCore: core.RegexWhen[R]
- 
      
      
      
        
      
    
      
        
        def
      
      
        toString(): String
      
      
      - Definition Classes
- RegexWhen → AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        toString(pattern: String): String
      
      
      - Definition Classes
- When
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @throws( ... )
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long, arg1: Int): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @throws( ... )
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @throws( ... )
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        when(pattern: Timeout.type): TimeoutWhen[R]
      
      
      Adds a new TimeoutWhenthat matches whenever the read from any of theFromStreamInputs times out.Adds a new TimeoutWhenthat matches whenever the read from any of theFromStreamInputs times out.- pattern
- the pattern to match against. 
- returns
- the new - TimeoutWhen.
 - Definition Classes
- Whenable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        when(pattern: EndOfFile.type, readFrom: FromInputStream): EndOfFileWhen[R]
      
      
      Adds a new EndOfFileWhenthat matches whenever the EndOfFile in read from the specifiedFromInputStream.Adds a new EndOfFileWhenthat matches whenever the EndOfFile in read from the specifiedFromInputStream.- pattern
- the pattern to match against. 
- readFrom
- from which - FromInputStreamto read the output.
- returns
- the new - EndOfFileWhen.
 - Definition Classes
- Whenable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        when(pattern: EndOfFile.type): EndOfFileWhen[R]
      
      
      Adds a new EndOfFileWhenthat matches whenever the EndOfFile in read fromFromInputStreamspecified in the parent ExpectBlock.Adds a new EndOfFileWhenthat matches whenever the EndOfFile in read fromFromInputStreamspecified in the parent ExpectBlock.- pattern
- the pattern to match against. 
- returns
- the new - EndOfFileWhen.
 - Definition Classes
- Whenable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        when(pattern: Regex, readFrom: FromInputStream): RegexWhen[R]
      
      
      Adds a new RegexWhenthat matches whenever the regexpatternsuccessfully matches against the text read from the specifiedFromInputStream.Adds a new RegexWhenthat matches whenever the regexpatternsuccessfully matches against the text read from the specifiedFromInputStream.- pattern
- the pattern to match against. 
- readFrom
- from which - FromInputStreamto read the output.
- returns
- the new - RegexWhen.
 - Definition Classes
- Whenable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        when(pattern: Regex): RegexWhen[R]
      
      
      Adds a new RegexWhenthat matches whenever the regexpatternsuccessfully matches against the text read fromFromInputStreamspecified in the parent ExpectBlock.Adds a new RegexWhenthat matches whenever the regexpatternsuccessfully matches against the text read fromFromInputStreamspecified in the parent ExpectBlock.- pattern
- the pattern to match against. 
- returns
- the new - RegexWhen.
 - Definition Classes
- Whenable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        when(pattern: String, readFrom: FromInputStream): StringWhen[R]
      
      
      Adds a new StringWhenthat matches wheneverpatternis contained in the text read from the specifiedFromInputStream.Adds a new StringWhenthat matches wheneverpatternis contained in the text read from the specifiedFromInputStream.- pattern
- the pattern to match against. 
- readFrom
- from which - FromInputStreamto read the output.
- returns
- the new - StringWhen.
 - Definition Classes
- Whenable
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        when(pattern: String): StringWhen[R]
      
      
      Adds a new StringWhenthat matches wheneverpatternis contained in the text read from theFromInputStreamspecified in the parent ExpectBlock.Adds a new StringWhenthat matches wheneverpatternis contained in the text read from theFromInputStreamspecified in the parent ExpectBlock.- pattern
- the pattern to match against. 
- returns
- the new - StringWhen.
 - Definition Classes
- Whenable
 
-  val whenableParent: ExpectBlock[R]
-  def →[B](y: B): (RegexWhen[R], B)