An example of ColumnFixture, ActionFixture and RowFixture
in perl.
A null value, i.e.
undef, is displayed as “NULL”, but the respective variables contain undef.
In order to achieve
this, we use a TypeAdapter, namely the NullFkWrapper.
Let’s start with some
data (may be the result of a selection on a database...)
NullValueTest |
||
id |
cname |
manager_id |
1 |
busik |
NULL |
2 |
berger |
1 |
3 |
maas |
1 |
4 |
fieg |
NULL |
5 |
tiebe |
1 |
NullValueTest is a
ColumnFixture, its purpose is solely to take the input data.
fit.ActionFixture |
|||
start |
RowsetFilter |
|
|
check |
rowCount |
0 |
should be empty on
beginning... |
enter |
findById |
1 |
|
check |
rowCount |
1 |
|
enter |
findByManagerId |
NULL |
|
enter |
rowCount |
2 |
|
Now you’ve seen an
ActionFixture in action...
How to check, if the
system found the right two rows? Let’s check it with a RowFixture
FilteredData |
|
id |
cname |
1 |
busik |
4 |
fieg |
You are interested in
the cname field only? No problem for a row fixture (and ok, since cname happies
to be unique too)
FilteredData |
cname |
busik |
fieg |
What about an empty
filtered data?
fit.ActionFixture |
|||
start |
RowsetFilter |
|
|
press |
clear |
|
|
FilteredData |
||
id |
cname |
manager_id |
Another filter...
fit.ActionFixture |
|||
start |
RowsetFilter |
|
|
enter |
findByManagerId |
1 |
|
FilteredData |
||
id |
cname |
manager_id |
2 |
berger |
1 |
3 |
maas |
1 |
5 |
tiebe |
1 |
fit.ActionFixture |
|||
start |
RowsetFilter |
|
|
press |
allRows |
|
|
In the output you
should see a row marked as “surplus”
FilteredData |
||
id |
cname |
manager_id |
1 |
busik |
NULL |
2 |
berger |
1 |
3 |
maas |
1 |
4 |
fieg |
NULL |
fit.Summary |
|