Let's start by looking at the fixture code for the previous example, shown in part again: |!-CalculatedDiscount-!| |''$''||''discount''| |2000.00||100.00| The fixture code is as follows: ----{{{public class CalculatedDiscount extends fitlibrary.CalculateFixture{ private Discount application = new Discount(); public double discountDollar(double amount) { return application.getDiscount(amount); } } }}}----The method ''discountDollar()'' is called for each of the rows. The ''given'' value is supplied as an argument to the method and the result is compared to the ''expected'' value. The header labels are used to determine the method name, being the ''expected'' column label followed by each of the ''given'' column labels ("discount" + "$"). This name is converted into a valid Java method name based on [[''extended camel''][.FitLibrary.FitLibraryUserGuide.ExtendedCamelCase]]. While this can result in some weird method names, it does given the Fit test writer considerable freedom of expression. !3 In General * For each ''expected'' column in a ''!-CalculateFixture-!'' table, there is a distinct method. The name of the method is created from the ''expected'' column label followed by each of the ''given'' column labels. The method has a parameter for each of the ''given'' columns and returns a result which is compared against the ''expected'' value. * As with [[''!-DoFixture-!''][.FitLibrary.FitLibraryUserGuide.DoFixture.FixtureDetails]], a ''!-SystemUnderTest-!'' object may be associated with a ''!-CalculateFixture-!''. If the fixture itself doesn't have a required method, the one in the ''!-SystemUnderTest-!'' is called instead. This means that the fixture acts as an adapter only when necessary, to map actions in the table into methods in the ''!-SystemUnderTest-!''. * To enable a specific string to signify repeating of the previous ''given'' value (" " is used in ''!-ColumnFixture-!''), call the ''!-CalculateFixture-!'' method ''setRepeatString()''. * To enable a specific string to signify an exception is ''expected ''("error" is used in ''!-ColumnFixture-!''), call the ''!-CalculateFixture-!'' method ''setExceptionString()''. In ''!-ColumnFixture-!'', " " as an ''expected'' value means that the actual value is displayed in the report. There is currently nothing directly equivalent to this in ''!-CalculateFixture-!''. The closest is a ''show'' special action in [[''!-DoFixture-!''][.FitLibraryUserGuide.DoFixture]] ---- * ''Copyright (c) 2004, 2005 Rick Mugridge, Rimu Research.'' * ''Released under the terms of the GNU General Public License version 2 or later.''