T - the type of values created by this case.public interface Case<T>
For example, the StringCase describes all of the different types of string that an application should be
able to handle. It provides several subcases, including the empty string, strings with non-ASCII characters, and
strings that contain characters with special meanings in various languages.
When a test consumes a particular case, it is making a broad statement that the code under test should be able to handle the values of each of the equivalency classes defined by that case.
Note to implementors: consider overriding the default implementations for the methods listed below. See comments on those methods for explanations.
| Modifier and Type | Method and Description |
|---|---|
default Case<T> |
excluding(Iterable<T> values) |
default Case<T> |
excluding(T... values) |
default Case<T> |
excluding(T value)
Constrains the
|
default Set<T> |
generateAllOnce()
Requests each of this case's subcases to generate and return a value.
|
default Set<T> |
generateAllOnce(Random random)
Requests each of this case's subcases to generate and return a value.
|
default T |
generateAnyOnce()
Arbitrarily selects and returns the value of one of this case's subcases.
|
default T |
generateAnyOnce(Random random)
Arbitrarily selects and returns the value of one of this case's subcases.
|
Set<Subcase<T>> |
getSubcases()
Returns the specific set of subcases that describe all equivalency classes for this case.
|
default Case<T> |
or(Case<T> other)
Returns a new case that combines the subcases of this case and the provided
other case. |
default Case<T> |
orNull()
Returns a new case that combines the subcases of this case and a subcase specifically generating the value
null. |
Set<Subcase<T>> getSubcases()
Cases are expected to return at least one subcase. When the fuzzy engine is determining how many test cases to execute, it does so in terms of subcases, not cases. Thus, when using the pairwise permutation algorithm, the fuzzy library works to ensure that each possible combination of two subcases are executed.
Note to implementors: cases should generally not include null values as
possible outputs. Instead, consumers are expected to use the orNull() method (or, equivalently,
Any.nullableOf(com.redfin.fuzzy.Case<T>)) to declare that their cases should also generate null values.
default Case<T> or(Case<T> other)
other case. This method can
be used to combine different cases for a value into a single generator.default Case<T> orNull()
null.default T generateAnyOnce()
default T generateAnyOnce(Random random)
random - the random number generator that will be used to create the returned value.default Set<T> generateAllOnce()
Copyright © 2017 Redfin. All rights reserved.