A table with 17 columns.
For an introduction to using tables, see the documentation for trait TableDrivenPropertyChecks.
This table is a sequence of Tuple17
objects, where each tuple represents one row of the table.
The first element of each tuple comprise the first column of the table, the second element of
each tuple comprise the second column, and so on. This table also carries with it
a heading tuple that gives string names to the columns of the table.
A handy way to create a TableFor17
is via an apply
factory method in the Table
singleton object provided by the Tables
trait. Here's an example:
val examples = Table( ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q"), ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), ( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), ( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), ( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4), ( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5), ( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6), ( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7), ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8), ( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9) )
Because you supplied 17 members in each tuple, the type you'll get back will be a TableFor17
.
The table provides an apply
method that takes a function with a parameter list that matches
the types and arity of the tuples contained in this table. The apply
method will invoke the
function with the members of each row tuple passed as arguments, in ascending order by index. (I.e.,
the zeroth tuple is checked first, then the tuple with index 1, then index 2, and so on until all the rows
have been checked (or until a failure occurs). The function represents a property of the code under test
that should succeed for every row of the table. If the function returns normally, that indicates the property
check succeeded for that row. If the function completes abruptly with an exception, that indicates the
property check failed and the apply
method will complete abruptly with a
TableDrivenPropertyCheckFailedException
that wraps the exception thrown by the supplied property function.
The usual way you'd invoke the apply
method that checks a property is via a forAll
method
provided by trait TableDrivenPropertyChecks
. The forAll
method takes a TableFor17
as its
first argument, then in a curried argument list takes the property check function. It invokes apply
on
the TableFor17
, passing in the property check function. Here's an example:
forAll (examples) { (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) => a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q should equal (a * 17) }
Because TableFor17
is a Seq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)]
, you can use it as a Seq
. For example, here's how
you could get a sequence of optional exceptions for each row of the table, indicating whether a property check succeeded or failed
on each row of the table:
for (row <- examples) yield { failureOf { row._1 should not equal (7) } }
Note: the failureOf
method, contained in the FailureOf
trait, will execute the supplied code (a by-name parameter) and
catch any exception. If no exception is thrown by the code, failureOf
will result in None
, indicating the "property check"
succeeded. If the supplied code completes abruptly in an exception that would normally cause a test to fail, failureOf
will result in
a Some
wrapping that exception. For example, the previous for expression would give you:
Vector(None, None, None, None, None, None, None, Some(org.scalatest.TestFailedException: 7 equaled 7), None, None)
This shows that all the property checks succeeded, except for the one at index 7.
a tuple containing string names of the columns in this table
a variable length parameter list of Tuple17
s containing the data of this table
o != arg0
is the same as !(o == (arg0))
.
o != arg0
is the same as !(o == (arg0))
.
the object to compare against this object for dis-equality.
false
if the receiver object is equivalent to the argument; true
otherwise.
o == arg0
is the same as if (o eq null) arg0 eq null else o.equals(arg0)
.
o == arg0
is the same as if (o eq null) arg0 eq null else o.equals(arg0)
.
the object to compare against this object for equality.
true
if the receiver object is equivalent to the argument; false
otherwise.
o == arg0
is the same as o.equals(arg0)
.
o == arg0
is the same as o.equals(arg0)
.
the object to compare against this object for equality.
true
if the receiver object is equivalent to the argument; false
otherwise.
Applies the passed property check function to each row of this TableFor17
.
Applies the passed property check function to each row of this TableFor17
.
If the property checks for all rows succeed (the property check function returns normally when passed
the data for each row), this apply
method returns normally. If the property check function
completes abruptly with an exception for any row, this apply
method wraps that exception
in a TableDrivenPropertyCheckFailedException
and completes abruptly with that exception. Once
the property check function throws an exception for a row, this apply
method will complete
abruptly immediately and subsequent rows will not be checked against the function.
the property check function to apply to each row of this TableFor17
Selects a row of data by its index.
Selects a row of data by its index.
This method is used to cast the receiver object to be of type T0
.
This method is used to cast the receiver object to be of type T0
.
Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression
1.asInstanceOf[String]
will throw a ClassCastException
at runtime, while the expression
List(1).asInstanceOf[List[String]]
will not. In the latter example, because the type argument is erased as
part of compilation it is not possible to check whether the contents of the list are of the requested typed.
the receiver object.
This method creates and returns a copy of the receiver object.
This method creates and returns a copy of the receiver object.
The default implementation of the clone
method is platform dependent.
a copy of the receiver object.
use iterator' instead
This method is used to test whether the argument (arg0
) is a reference to the
receiver object (this
).
This method is used to test whether the argument (arg0
) is a reference to the
receiver object (this
).
The eq
method implements an [http://en.wikipedia.org/wiki/Equivalence_relation equivalence relation] on
non-null instances of AnyRef
:
* It is reflexive: for any non-null instance x
of type AnyRef
, x.eq(x)
returns true
.
* It is symmetric: for any non-null instances x
and y
of type AnyRef
, x.eq(y)
returns true
if and
only if y.eq(x)
returns true
.
* It is transitive: for any non-null instances x
, y
, and z
of type AnyRef
if x.eq(y)
returns true
and y.eq(z)
returns true
, then x.eq(z)
returns true
.
Additionally, the eq
method has three other properties.
* It is consistent: for any non-null instances x
and y
of type AnyRef
, multiple invocations of
x.eq(y)
consistently returns true
or consistently returns false
.
* For any non-null instance x
of type AnyRef
, x.eq(null)
and null.eq(x)
returns false
.
* null.eq(null)
returns true
.
When overriding the equals
or hashCode
methods, it is important to ensure that their behavior is
consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2
), they
should be equal to each other (o1 == o2
) and they should hash to the same value (o1.hashCode == o2.hashCode
).
the object to compare against this object for reference equality.
true
if the argument is a reference to the receiver object; false
otherwise.
This method is used to compare the receiver object (this
) with the argument object (arg0
) for equivalence.
This method is used to compare the receiver object (this
) with the argument object (arg0
) for equivalence.
The default implementations of this method is an [http://en.wikipedia.org/wiki/Equivalence_relation equivalence
relation]:
* It is reflexive: for any instance x
of type Any
, x.equals(x)
should return true
.
* It is symmetric: for any instances x
and y
of type Any
, x.equals(y)
should return true
if and
only if y.equals(x)
returns true
.
* It is transitive: for any instances x
, y
, and z
of type AnyRef
if x.equals(y)
returns true
and
y.equals(z)
returns true
, then x.equals(z)
should return true
.
If you override this method, you should verify that your implementation remains an equivalence relation.
Additionally, when overriding this method it is often necessary to override hashCode
to ensure that objects
that are "equal" (o1.equals(o2)
returns true
) hash to the same scala.Int
(o1.hashCode.equals(o2.hashCode)
).
true
if the receiver object is equivalent to the argument; false
otherwise.
use corresponds
instead
This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.
This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.
The details of when and if the finalize
method are invoked, as well as the interaction between finalize
and non-local returns and exceptions, are all platform dependent.
Use indexWhere(p) instead.
use lastIndexWhere
instead
use head' instead
use headOption' instead
Returns a representation that corresponds to the dynamic class of the receiver object.
Returns a representation that corresponds to the dynamic class of the receiver object.
The nature of the representation is platform dependent.
a representation that corresponds to the dynamic class of the receiver object.
Returns a hash code value for the object.
Returns a hash code value for the object.
The default hashing algorithm is platform dependent.
Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)
) yet
not be equal (o1.equals(o2)
returns false
). A degenerate implementation could always return 0
.
However, it is required that if two objects are equal (o1.equals(o2)
returns true
) that they have
identical hash codes (o1.hashCode.equals(o2.hashCode)
). Therefore, when overriding this method, be sure
to verify that the behavior is consistent with the equals
method.
the hash code value for the object.
a tuple containing string names of the columns in this table
a tuple containing string names of the columns in this table
This method is used to test whether the dynamic type of the receiver object is T0
.
This method is used to test whether the dynamic type of the receiver object is T0
.
Note that the test result of the test is modulo Scala's erasure semantics. Therefore the expression
1.isInstanceOf[String]
will return false
, while the expression List(1).isInstanceOf[List[String]]
will
return true
. In the latter example, because the type argument is erased as part of compilation it is not
possible to check whether the contents of the list are of the requested typed.
true
if the receiver object is an instance of erasure of type T0
; false
otherwise.
The number of rows of data in the table.
The number of rows of data in the table. (This does not include the heading
tuple)
o.ne(arg0)
is the same as !(o.eq(arg0))
.
o.ne(arg0)
is the same as !(o.eq(arg0))
.
the object to compare against this object for reference dis-equality.
false
if the argument is not a reference to the receiver object; true
otherwise.
Creates a new Builder
for TableFor17
s.
Creates a new Builder
for TableFor17
s.
Wakes up a single thread that is waiting on the receiver object's monitor.
Wakes up a single thread that is waiting on the receiver object's monitor.
Wakes up all threads that are waiting on the receiver object's monitor.
Wakes up all threads that are waiting on the receiver object's monitor.
use view' instead
use reverseIterator' instead
A string representation of this object, which includes the heading strings as well as the rows of data.
A string representation of this object, which includes the heading strings as well as the rows of data.@return a string representation of the object. */
A table with 17 columns.
For an introduction to using tables, see the documentation for trait TableDrivenPropertyChecks.
This table is a sequence of
Tuple17
objects, where each tuple represents one row of the table. The first element of each tuple comprise the first column of the table, the second element of each tuple comprise the second column, and so on. This table also carries with it a heading tuple that gives string names to the columns of the table.A handy way to create a
TableFor17
is via anapply
factory method in theTable
singleton object provided by theTables
trait. Here's an example:Because you supplied 17 members in each tuple, the type you'll get back will be a
TableFor17
.The table provides an
apply
method that takes a function with a parameter list that matches the types and arity of the tuples contained in this table. Theapply
method will invoke the function with the members of each row tuple passed as arguments, in ascending order by index. (I.e., the zeroth tuple is checked first, then the tuple with index 1, then index 2, and so on until all the rows have been checked (or until a failure occurs). The function represents a property of the code under test that should succeed for every row of the table. If the function returns normally, that indicates the property check succeeded for that row. If the function completes abruptly with an exception, that indicates the property check failed and theapply
method will complete abruptly with aTableDrivenPropertyCheckFailedException
that wraps the exception thrown by the supplied property function.The usual way you'd invoke the
apply
method that checks a property is via aforAll
method provided by traitTableDrivenPropertyChecks
. TheforAll
method takes aTableFor17
as its first argument, then in a curried argument list takes the property check function. It invokesapply
on theTableFor17
, passing in the property check function. Here's an example:Because
TableFor17
is aSeq[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)]
, you can use it as aSeq
. For example, here's how you could get a sequence of optional exceptions for each row of the table, indicating whether a property check succeeded or failed on each row of the table:Note: the
failureOf
method, contained in theFailureOf
trait, will execute the supplied code (a by-name parameter) and catch any exception. If no exception is thrown by the code,failureOf
will result inNone
, indicating the "property check" succeeded. If the supplied code completes abruptly in an exception that would normally cause a test to fail,failureOf
will result in aSome
wrapping that exception. For example, the previous for expression would give you:This shows that all the property checks succeeded, except for the one at index 7.