-
Notifications
You must be signed in to change notification settings - Fork 2
Parameters
Tables can be parameterized with TableParameters. But FitGoodies also supports parameters in cells. These parameters are mostly used to configure Parsers and TypeAdapters, but they can also be used for custom behaviors.
The best example is the ColumnFixture. Imagine, you have a column which holds times, and another one which holds dates. How to tell Fit the format of the columns? How about this?
MyFixture | ||
---|---|---|
d1[de_DE, dd.MM.yyyy] | d2[en_US hh:mm] | combined?[en_US, MM/dd/yyyy hh:mm:ss] |
01.03.2009 | 20:15 | 03/01/2009 20:15:00 |
08.05.2005 | 00:07 | 08/05/2005 00:07:00 |
import de.cologneintelligence.fitgoodies.ColumnFixture;
import de.cologneintelligence.fitgoodies.util.FixtureTools;
import java.util.Date;
public class MyFixture extends ColumnFixture {
public Date d1;
public Date d2;
public Date combined() {
MyDate myDate = new MyDate(d1);
myDate.add(d2);
return myDate.toDate();
}
}
As you can see, most of the thinks happen in the background. If you inherit from de.cologneintelligence.fitgoodies.Fixture
you have more control. It is also possible to parameterize a single cell. One example for this is the LogFixture; consider the following row:
rootLogger | stdout | contains[Thread = WorkerThread3, MinLevel = Info] | no error was detected |
Each Fixture can decide how to handle this parameters. See CellParameters for an example.