A nullary (zero-parameter) "function" that is a bit friendlier to testing.
This is a variant of () => A
-- that is, a function that takes no parameters
and returns an A. In practice, that isn't quite true: where () => A
is
lazy (it is not evaluated until you call it), this one is strict (you pass the
result in as a parameter).
In exchange, this is more usable and reproducible for test environments. Its
hashCode
and equals
are based on those of the passed-in value (so they are
consistent and reproducible), and its toString
nicely displays the result
that will always be returned.
- Type parameters:
- A
the type that is returned by this function
- Value parameters:
- result
the value that will be returned by this function
- Companion:
- object
trait () => A
class Object
trait Matchable
class Any