Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package scalatestplus
    Definition Classes
    org
  • package junit
    Definition Classes
    scalatestplus
  • object AssertionsForJUnit extends AssertionsForJUnit

    Companion object that facilitates the importing of AssertionsForJUnit members as an alternative to mixing it in.

    Companion object that facilitates the importing of AssertionsForJUnit members as an alternative to mixing it in. One use case is to import AssertionsForJUnit members so you can use them in the Scala interpreter:

    $ scala -cp junit3.8.2/junit.jar:../target/jar_contents
    Welcome to Scala version 2.7.5.final (Java HotSpot(TM) Client VM, Java 1.5.0_16).
    Type in expressions to have them evaluated.
    Type :help for more information.
    
    scala> import org.scalatest.junit.AssertionsForJUnit._
    import org.scalatest.junit.AssertionsForJUnit._
    
    scala> assert(1 === 2)
    junit.framework.AssertionFailedError: 1 did not equal 2
    	at org.scalatest.junit.AssertionsForJUnit$class.assert(AssertionsForJUnit.scala:353)
    	at org.scalatest.junit.AssertionsForJUnit$.assert(AssertionsForJUnit.scala:672)
    	at .(:7)
    	at .()
    	at RequestResult$.(:3)
    	at RequestResult$.()
    	at RequestResult$result( expect(3) { 1 + 3 }
    junit.framework.AssertionFailedError: Expected 3, but got 4
    	at org.scalatest.junit.AssertionsForJUnit$class.expect(AssertionsForJUnit.scala:563)
    	at org.scalatest.junit.AssertionsForJUnit$.expect(AssertionsForJUnit.scala:672)
    	at .(:7)
    	at .()
    	at RequestResult$.(:3)
    	at RequestResult$.()
    	at RequestResult$result( val caught = intercept[StringIndexOutOfBoundsException] { "hi".charAt(-1) }
    caught: StringIndexOutOfBoundsException = java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    

    Definition Classes
    junit
  • AssertionsHelper
  • CheckingEqualizer
  • Equalizer
ScalaTest is brought to you by:

class AssertionsHelper extends AnyRef

Helper class used by code generated by the assert macro.

Source
AssertionsForJUnit.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AssertionsHelper
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new AssertionsHelper()

Value Members

  1. def macroAssert(bool: Bool, clue: Any, pos: Position): Assertion
  2. def macroAssert(bool: Bool, clue: Any, prettifier: Prettifier, pos: Position): Assertion

    Assert that the passed in Bool is true, else fail with TestFailedException.

    Assert that the passed in Bool is true, else fail with TestFailedException.

    bool

    the Bool to assert for

    clue

    optional clue to be included in TestFailedException's error message when assertion failed

  3. def macroAssume(bool: Bool, clue: Any, pos: Position): Assertion
  4. def macroAssume(bool: Bool, clue: Any, prettifier: Prettifier, pos: Position): Assertion

    Assume that the passed in Bool is true, else throw TestCanceledException.

    Assume that the passed in Bool is true, else throw TestCanceledException.

    bool

    the Bool to assume for

    clue

    optional clue to be included in TestCanceledException's error message when assertion failed