${fitLibrary} needs to convert from the text in a table cell to some value (object or primitive value). It does this even when it's just checking values. * It includes ${parser}s for the standard primitive types, their class equivalents (eg Integer), and String. ${fitLibrary} determines the type of value required by reflectively looking at method and other signatures. * For example, a ${workflow} action corresponds to a method. The return type and parameter types of the method are used to work out the type of the corresponding cells in the table, and suitable ${parser}s are used. * Eg, consider the method: * ''public boolean greater(int x, int y)'' * Three ${parser}s are used, one for the return type and one for each of the parameter types. A ${parser} carries out three functions: * ''parseTyped()'': Converts the text from a table cell into a value * ''show()'': Converts a value into text to be shown in a report * ''matches()'': Compares two values to see if they're the same, such as when checking the actual elements of a list against those expected !3 1. How a ${parser} is Selected by ${fitLibrary} If there is no built-in ${parser} for a class ''T'', ${fitLibrary} tries the following in order until finding a ${parser}: * If a ''parse delegate'' has been registered for the class T, that acts as a ${parser} for T. * See below for details of the three types of delegates. * If there is a ''!-PropertyEditor-!'' corresponding to the class T, that's used: * the editor's methods ''setAsText()'' and ''getValue()'' are used together for ''parseTyped()''; * the editor's methods ''setValue()'' and ''getAsText()'' are used together for ''show()''; and * the ''equals()'' in class T is used for ''matches()''. * If the class has a ''public static parse(String) method'', that's used: * that method ''parse()'' in T is used for ''parseTyped()''; * the method ''toString()'' in T is used for ''show()''; and * the method ''equals()'' in T is used for ''matches()''. * If the class has a constructor (it doesn't need to be public) that takes a String as an argument, that's used: * that constructor is used for ''parseTyped()''; * the method ''toString()'' in T is used for ''show()''; and * the method ''equals()'' in T is used for ''matches()''. * ... !3 2. Choosing the Best Approach for You: (2.1) It's a class T that you can change: * The simplest approach is to add a ''public static parse(String)'' method to T. But that won't work if: * that ''parse()'' method is already being used for something else; or * The next simplest approach is to add to T a constructor that takes a String as argument. But that won't work if: * that constructor is already being used for something else; or * The above two approaches also won't work if: * you want an object of T to be displayed in the report in a special way, rather than using its ''toString()'' method; or * you want a specialised way of comparing two values of that type, so it's ''equals()'' method won't do; or * you want to vary the way that such values are parsed from one storytest to the next * Otherwise, you'll need to use one of the approaches below. (2.2) It's a class T that you can '''not''' change: * finder * property editor * register delegate * ... One approach ${fitLibrary} uses to parsing the text in a cell is to use a ${finder}. * This can be a good way to handle special values, whether for your own classes or those of others. * For further details, see ${finder}