#46 Regular expressions in table assertions

Jevon Wright
Core API (44)
Garrett Smith

There are cases where I don't know exactly what a table
cell will contain. E.g. a date/time stamp, a randomly
assigned ID, etc. It would be very useful to have
regular expression support in the table assertions.

There are a couple other feature requests dealing with
table assertions that I believe could be accommodated
with regex: the 'startswith' assertion request and the
'assert rows' request. Startswith is easy enough to
implement using regex and one could assert a number of
rows (e.g. 2 rows and 2 cells) using something like:

assertTableEquals("foo", new String[][]
{ ".*", ".*"},
{".*", ".*"});

As far as the interface, you could add another
signature of each of the assertTableXXX methods that
takes a boolean flag useRegex, e.g. Or add methods such
as assertTableEqualsExpr(...).

As a much simpler implementation, you could forget
regular expression support and just accept nulls for
table cell values, which would indicate the user
doesn't care what value exists. This would satisfy the
date/time and random ID issue, but wouldn't help the
guy who wanted 'startswith'.

Just some thoughts.


  • Garrett Smith
    Garrett Smith

    Logged In: YES

    Oops..I just spotted the other regex feature request. Oh
    well :-/

  • Jevon Wright
    Jevon Wright

    • labels: --> Core API
    • milestone: --> Release_2.1
    • priority: 5 --> 3
    • assigned_to: nobody --> jevonwright