Package

org.scalatest

words

Permalink

package words

Visibility
  1. Public
  2. All

Type Members

  1. final class BeWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers or MustMatchers for an overview of the matchers DSL.

    Class BeWord contains an apply method that takes a Symbol, which uses reflection to find and access a Boolean property and determine if it is true. If the symbol passed is 'empty, for example, the apply method will use reflection to look for a public Java field named "empty", a public method named "empty", or a public method named "isEmpty". If a field, it must be of type Boolean. If a method, it must take no parameters and return Boolean. If multiple candidates are found, the apply method will select based on the following algorithm:

    FieldMethod"is" MethodResult
       Throws TestFailedException, because no candidates found
      isEmpty()Invokes isEmpty()
     empty() Invokes empty()
     empty()isEmpty()Invokes empty() (this can occur when BeanProperty annotation is used)
    empty  Accesses field empty
    empty isEmpty()Invokes isEmpty()
    emptyempty() Invokes empty()
    emptyempty()isEmpty()Invokes empty() (this can occur when BeanProperty annotation is used)

  2. final class BehaveWord extends AnyRef

    Permalink

    Class that supports shared test registration via instances referenced from the behave field of FunSpecs, FlatSpecs, and WordSpecs as well as instance of their sister traits, fixture.FunSpec, fixture.FlatSpec, and fixture.WordSpec.

    Class that supports shared test registration via instances referenced from the behave field of FunSpecs, FlatSpecs, and WordSpecs as well as instance of their sister traits, fixture.FunSpec, fixture.FlatSpec, and fixture.WordSpec.

    This class, via the behave field, enables syntax such as the following in FunSpecs, FlatSpecs, fixture.FunSpecs, and fixture.FlatSpecs:

    it should behave like nonFullStack(stackWithOneItem)
              ^
    

    It also enables syntax such as the following syntax in WordSpecs and fixture.WordSpecs:

    behave like nonEmptyStack(lastValuePushed)
    ^
    

    For more information and examples of the use of <cod>behave, see the Shared tests section in the main documentation for trait FunSpec, FlatSpec, or WordSpec.

  3. trait CanVerb extends AnyRef

    Permalink

    Provides an implicit conversion that adds can methods to String to support the syntax of FlatSpec, WordSpec, org.scalatest.fixture.FlatSpec, and fixture.WordSpec.

    Provides an implicit conversion that adds can methods to String to support the syntax of FlatSpec, WordSpec, org.scalatest.fixture.FlatSpec, and fixture.WordSpec.

    For example, this trait enables syntax such as the following test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (when empty)" can "be empty" in { ... }
                           ^
    

    It also enables syntax such as the following shared test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (with one item)" can behave like nonEmptyStack(stackWithOneItem, lastValuePushed)
                              ^
    

    In addition, it supports the registration of subject descriptions in WordSpec and fixture.WordSpec, such as:

    "A Stack (when empty)" can { ...
                           ^
    

    And finally, it also supportds the registration of subject descriptions with after words in WordSpec and fixture.WordSpec. For example:

       def provide = afterWord("provide")
    
      "The ScalaTest Matchers DSL" can provide {
                                   ^
    

    The reason this implicit conversion is provided in a separate trait, instead of being provided directly in FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec, is primarily for design symmetry with ShouldVerb and MustVerb. Both ShouldVerb and MustVerb must exist as a separate trait because an implicit conversion provided directly would conflict with the implicit conversion that provides should or must methods on String in the Matchers and MustMatchers traits.

  4. final class CompileWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  5. final class ContainWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  6. final class DefinedWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  7. final class EmptyWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  8. final class EndWithWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  9. final class ExistWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  10. final class FullyMatchWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  11. final class HaveWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  12. final class IncludeWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  13. final class LengthWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  14. final class MatchPatternWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  15. trait MatcherWords extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  16. trait MustVerb extends AnyRef

    Permalink

    Provides an implicit conversion that adds must methods to String to support the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.

    Provides an implicit conversion that adds must methods to String to support the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.

    For example, this trait enables syntax such as the following test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (when empty)" must "be empty" in { ... }
                           ^
    

    It also enables syntax such as the following shared test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (with one item)" must behave like nonEmptyStack(stackWithOneItem, lastValuePushed)
                              ^
    

    In addition, it supports the registration of subject descriptions in WordSpec and fixture.WordSpec, such as:

    "A Stack (when empty)" must { ...
                           ^
    

    And finally, it also supportds the registration of subject descriptions with after words in WordSpec and fixture.WordSpec. For example:

       def provide = afterWord("provide")
    
      "The ScalaTest Matchers DSL" must provide {
                                   ^
    

    The reason this implicit conversion is provided in a separate trait, instead of being provided directly in FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec, is because an implicit conversion provided directly would conflict with the implicit conversion that provides must methods on String in the MustMatchers trait. By contrast, there is no conflict with the separate MustVerb trait approach, because:

    • FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec mix in MustVerb directly, and
    • MustMatchers extends MustVerb, overriding the convertToStringMustWrapper implicit conversion function.

    So whether or not a FlatSpec, WordSpec, fixture.FlatSpec, or fixture.WordSpec mixes in MustMatchers, there will only be one implicit conversion in scope that adds must methods to Strings.

    Also, because the class of the result of the overriding convertToStringMustWrapper implicit conversion method provided in MustMatchers extends this trait's StringMustWrapperForVerb class, the four uses of must provided here are still available. These four must are in fact available to any class that mixes in MustMatchers, but each takes an implicit parameter that is provided only in FlatSpec and fixture.FlatSpec, or WordSpec and fixture.WordSpec.

  17. final class NoExceptionWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  18. final class NotWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  19. final class PleaseUseNoExceptionShouldSyntaxInstead extends AnyRef

    Permalink
  20. final class ReadableWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  21. final class RegexWithGroups extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  22. final class ResultOfATypeInvocation[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  23. final class ResultOfAWordToAMatcherApplication[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  24. final class ResultOfAWordToBePropertyMatcherApplication[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  25. final class ResultOfAWordToSymbolApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  26. final class ResultOfAfterWordApplication extends AnyRef

    Permalink

    Class that supports the use of after words in WordSpec and fixture.WordSpec.

    Class that supports the use of after words in WordSpec and fixture.WordSpec.

    A ResultOfAfterWordApplication, which encapsulates the text of the after word and a block, is accepted by when, should, must, can, and that methods. For more information, see the main documentation for trait WordSpec.

  27. class ResultOfAllElementsOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  28. class ResultOfAllOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  29. final class ResultOfAnTypeInvocation[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  30. final class ResultOfAnWordToAnMatcherApplication[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  31. final class ResultOfAnWordToBePropertyMatcherApplication[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  32. final class ResultOfAnWordToSymbolApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  33. class ResultOfAtLeastOneElementOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  34. class ResultOfAtLeastOneOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  35. class ResultOfAtMostOneElementOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  36. class ResultOfAtMostOneOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  37. final class ResultOfBeThrownBy extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  38. final class ResultOfBeWordForAType[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  39. final class ResultOfBeWordForAnType[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  40. final class ResultOfBeWordForNoException extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  41. class ResultOfContainWord[L] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  42. final class ResultOfDefinedAt[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  43. final class ResultOfGreaterThanComparison[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  44. final class ResultOfGreaterThanOrEqualToComparison[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  45. class ResultOfInOrderApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  46. class ResultOfInOrderElementsOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  47. class ResultOfInOrderOnlyApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  48. final class ResultOfKeyWordApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  49. final class ResultOfLengthWordApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  50. final class ResultOfLessThanComparison[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  51. final class ResultOfLessThanOrEqualToComparison[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  52. final class ResultOfMessageWordApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  53. class ResultOfNoElementsOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  54. class ResultOfNoneOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  55. final class ResultOfNotExist extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  56. sealed class ResultOfNotWordForAny[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  57. final class ResultOfOfTypeInvocation[T] extends AnyRef

    Permalink
  58. class ResultOfOneElementOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  59. class ResultOfOneOfApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  60. class ResultOfOnlyApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  61. final class ResultOfRegexWordApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

    The primary constructor enables the following syntax (with a passed scala.util.matching.Regex):

    "eight" should not fullyMatch regex ("""(-)?(\d+)(\.\d*)?""".r)
                                  ^
    

  62. final class ResultOfSizeWordApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  63. abstract class ResultOfStringPassedToVerb extends AnyRef

    Permalink

    Abstract class that supports test registration in FlatSpec and fixture.FlatSpec.

    Abstract class that supports test registration in FlatSpec and fixture.FlatSpec.

    For example, this class enables syntax such as the following pending test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (when empty)" should "be empty" is (pending)
                                             ^
    

    For example, this class enables syntax such as the following tagged test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (when empty)" should "be empty" taggedAs(SlowTet) in { ... }
                                             ^
    

    This class also indirectly enables syntax such as the following regular test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (when empty)" should "be empty" in { ... }
                                             ^
    

    However, this class does not declare any methods named in, because the type passed to in differs in a FlatSpec and a fixture.FlatSpec. A fixture.FlatSpec needs two in methods, one that takes a no-arg test function and another that takes a one-arg test function (a test that takes a Fixture as its parameter). By constrast, a FlatSpec needs only one in method that takes a by-name parameter. As a result, FlatSpec and fixture.FlatSpec each provide an implicit conversion from ResultOfStringPassedToVerb to a type that provides the appropriate in methods.

  64. abstract class ResultOfTaggedAsInvocation extends AnyRef

    Permalink

    Supports the registration of tagged tests in shorthand form in FlatSpec and fixture.FlatSpec.

    Supports the registration of tagged tests in shorthand form in FlatSpec and fixture.FlatSpec.

    For example, this class enables syntax such as the following tagged, pending test registration in shorthand form:

    "A Stack (when empty)" should "be empty" taggedAs() is (pending)
                                                        ^
    

    In addition, this class indirectly enables syntax such as the following tagged test registration in shorthand form:

    "A Stack (when empty)" should "be empty" taggedAs() in { ... }
                                                        ^
    

    Rather than provide in and ignore methods directly, these methods are provided after taggedAs() by implicit conversions because the type passed to in (and ignore) differs in a FlatSpec and a fixture.FlatSpec. A fixture.FlatSpec needs two in methods, one that takes a no-arg test function and another that takes a one-arg test function (a test that takes a Fixture as its parameter). By constrast, a FlatSpec needs only one in method that takes a by-name parameter. As a result, FlatSpec and fixture.FlatSpec each provide an implicit conversion from ResultOfTaggedAsInvocation to a type that provides the appropriate in methods.

  65. class ResultOfTheSameElementsAsApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  66. class ResultOfTheSameElementsInOrderAsApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  67. final class ResultOfTheSameInstanceAsApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  68. final class ResultOfTheTypeInvocation[T] extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  69. final class ResultOfThrownByApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  70. final class ResultOfValueWordApplication extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  71. trait ShouldVerb extends AnyRef

    Permalink

    Provides an implicit conversion that adds should methods to String to support the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.

    Provides an implicit conversion that adds should methods to String to support the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.

    For example, this trait enables syntax such as the following test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (when empty)" should "be empty" in { ... }
                           ^
    

    It also enables syntax such as the following shared test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (with one item)" should behave like nonEmptyStack(stackWithOneItem, lastValuePushed)
                              ^
    

    In addition, it supports the registration of subject descriptions in WordSpec and fixture.WordSpec, such as:

    "A Stack (when empty)" should { ...
                           ^
    

    And finally, it also supportds the registration of subject descriptions with after words in WordSpec and fixture.WordSpec. For example:

       def provide = afterWord("provide")
    
      "The ScalaTest Matchers DSL" should provide {
                                   ^
    

    The reason this implicit conversion is provided in a separate trait, instead of being provided directly in FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec, is because an implicit conversion provided directly would conflict with the implicit conversion that provides should methods on String in the Matchers trait. By contrast, there is no conflict with the separate ShouldVerb trait approach, because:

    • FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec mix in ShouldVerb directly, and
    • Matchers extends ShouldVerb, overriding the convertToStringShouldWrapper implicit conversion function.

    So whether or not a FlatSpec, WordSpec, fixture.FlatSpec, or fixture.WordSpec mixes in Matchers, there will only be one implicit conversion in scope that adds should methods to Strings.

    Also, because the class of the result of the overriding convertToStringShouldWrapper implicit conversion method provided in Matchers extends this trait's StringShouldWrapperForVerb class, the four uses of should provided here are still available. These four should are in fact available to any class that mixes in Matchers, but each takes an implicit parameter that is provided only in FlatSpec and fixture.FlatSpec, or WordSpec and fixture.WordSpec.

  72. final class SizeWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  73. final class SortedWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  74. final class StartWithWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  75. abstract class StringVerbBlockRegistration extends (String, String, () ⇒ Unit) ⇒ Unit

    Permalink

    Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in WordSpec and fixture.WordSpec.

    Class that provides a role-specific type for an implicit conversion used to support the registration of subject descriptions in WordSpec and fixture.WordSpec.

    For example, this class enables syntax such as the following in WordSpec and fixture.WordSpec:

    "A Stack (when empty)" should { ...
                           ^
    

    This should method, which is provided in ShouldVerb, needs an implicit parameter of type (String, String, () => Unit) => Unit. Because the required type has no ScalaTest-specific types in it, it is possible that another implicit parameter of that same type could be in scope, which would cause a compile failure. Requiring an implicit parameter of the more specific StringVerbBlockRegistration, which simply extends the needed type, (String, String, () => Unit) => Unit, avoids this potential conflict.

  76. final class TypeCheckWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

  77. trait WillVerb extends AnyRef

    Permalink

    Provides an implicit conversion that adds will methods to String to support the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.

    Provides an implicit conversion that adds will methods to String to support the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.

    For example, this trait enables syntax such as the following test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (when empty)" will "be empty" in { ... }
                           ^
    

    It also enables syntax such as the following shared test registration in FlatSpec and fixture.FlatSpec:

    "A Stack (with one item)" will behave like nonEmptyStack(stackWithOneItem, lastValuePushed)
                              ^
    

    In addition, it supports the registration of subject descriptions in WordSpec and fixture.WordSpec, such as:

    "A Stack (when empty)" will { ...
                           ^
    

    And finally, it also supportds the registration of subject descriptions with after words in WordSpec and fixture.WordSpec. For example:

       def provide = afterWord("provide")
    
      "The ScalaTest Matchers DSL" will provide {
                                   ^
    

    The reason this implicit conversion is provided in a separate trait, instead of being provided directly in FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec, is because an implicit conversion provided directly would conflict with the implicit conversion that provides will methods on String in the Matchers trait. By contrast, there is no conflict with the separate WillVerb trait approach, because:

    • FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec mix in WillVerb directly, and
    • Matchers extends WillVerb, overriding the convertToStringWillWrapper implicit conversion function.

    So whether or not a FlatSpec, WordSpec, fixture.FlatSpec, or fixture.WordSpec mixes in Matchers, there will only be one implicit conversion in scope that adds will methods to Strings.

    Also, because the class of the result of the overriding convertToStringWillWrapper implicit conversion method provided in Matchers extends this trait's StringWillWrapperForVerb class, the four uses of will provided here are still available. These four will are in fact available to any class that mixes in Matchers, but each takes an implicit parameter that is provided only in FlatSpec and fixture.FlatSpec, or WordSpec and fixture.WordSpec.

  78. final class WritableWord extends AnyRef

    Permalink

    This class is part of the ScalaTest matchers DSL.

    This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of the matchers DSL.

Value Members

  1. object MatcherWords extends MatcherWords

    Permalink

Ungrouped