Section 25.1. Standard Values


25.1. Standard Values

When it interprets a table, a Fit fixture checks the types of the instance variables and methods involved, using reflection. For example, for each label in a header row, ColumnFixture checks in the fixture object for the corresponding variable or method.

For each public instance variable, method parameter, and method return value that's used in a table, Fit creates an appropriately typed TypeAdapter object. For a public instance variable, a TypeAdapter is first passed an object from which it accesses the appropriate public instance variable; that object is a fixture object for ColumnFixture and any object, in an array, for RowFixture.

A TypeAdapter object is able to

  • Accept a textual version of the expected value, such as 2.3, and convert it to a value of the underlying type. This is used

    To assign a value to an instance variable by a ColumnFixture

    To compare it with an actual value by many of the fixtures

    As a method parameter, with an enter by an ActionFixture

  • Take the actual value from an instance variable or method call of a given object and compare it to the expected value. This is used when checking the value of

    A calculated field by a ColumnFixture

    An instance variable or method call by a RowFixture

    A method call with a check by an ActionFixture

  • Produce a textual version of a value, to be used in reporting differences between expected and actual values.

Fit has TypeAdapters for all the primitive Java types and their corresponding wrapper classes, such as class Double for a double, so that these can all be used as values in tables. There are also TypeAdapters for the classes String, Date, and ScientificDouble[1] and for arrays of any of these classes or of the primitive types. An array value is a comma-separated list of values, such as 1, 2, 3, as shown in Section 3.4 on p. 19.

[1] A Number class that is provided with Fit.

That's all we need to know about TypeAdapters for this chapter. Some of the other functionality of TypeAdapter is covered in Section 37.6 on p. 311.



    Fit for Developing Software. Framework for Integrated Tests
    Fit for Developing Software: Framework for Integrated Tests
    ISBN: 0321269349
    EAN: 2147483647
    Year: 2005
    Pages: 331

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net