If message or message contents are null, throw a null exception, otherwise create a function that returns the option.
(Since version 3.1.0) The conversionCheckedConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
(Since version 3.1.0) The convertEquivalenceToAToBConversionConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
(Since version 3.1.0) The convertEquivalenceToBToAConversionConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
(Since version 3.1.0) The lowPriorityConversionCheckedConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
Trait that contains ScalaTest's basic assertion methods, suitable for use with JUnit.
The assertion methods provided in this trait look and behave exactly like the ones in
Assertions, except instead of throwingTestFailedExceptionthey throwJUnitTestFailedError, which extendsjunit.framework.AssertionFailedError.JUnit 3 (release 3.8 and earlier) distinguishes between failures and errors. If a test fails because of a failed assertion, that is considered a failure. If a test fails for any other reason, either the test code or the application being tested threw an unexpected exception, that is considered an error. The way JUnit 3 decides whether an exception represents a failure or error is that only thrown
junit.framework.AssertionFailedErrors are considered failures. Any other exception type is considered an error. The exception type thrown by the JUnit 3 assertion methods declared injunit.framework.Assert(such asassertEquals,assertTrue, andfail) is, therefore,AssertionFailedError.In JUnit 4,
AssertionFailedErrorwas made to extendjava.lang.AssertionError, and the distinction between failures and errors was essentially dropped. However, some tools that integrate with JUnit carry on this distinction, so even if you are using JUnit 4 you may want to use thisAssertionsForJUnittrait instead of plain-old ScalaTestAssertions.To use this trait in a JUnit 3
TestCase, you can mix it into yourTestCaseclass, like this:import junit.framework.TestCase import org.scalatest.junit.AssertionsForJUnit class MyTestCase extends TestCase with AssertionsForJUnit { def testSomething() { assert("hi".charAt(1) === 'i') } // ... }You can alternatively import the methods defined in this trait.
import junit.framework.TestCase import org.scalatest.junit.AssertionsForJUnit._ class MyTestCase extends TestCase { def testSomething() { assert("hi".charAt(1) === 'i') } // ... }For details on the importing approach, see the documentation for the
AssertionsForJUnitcompanion object. For the details on theAssertionsForJUnitsyntax, see the Scaladoc documentation fororg.scalatest.Assertions