38.1. Using SetUpFixtureA SetUpFixture table may be used for setting up the data at the start of a test, as we saw in Section 10.4 on p. 76. The setup table from that example is shown again in Figure 38.1. The fixture for that example was covered in Section 28.7 on p. 239, and is shown again in Listing 38.1.
The method futureValueMaxBalanceMinPurchaseDiscountPercent() in class SetUpDiscounts in Listing 38.1 is called for each data row in the table. The name of the method is derived from concatenating the labels in the header row of the table. Listing 38.1. SetUpDiscounts.javapublic class SetUpDiscounts extends SetUpFixture { private DiscountApplication app; public SetUpDiscounts(DiscountApplication app) { this.app = app; } public void futureValueMaxBalanceMinPurchaseDiscountPercent( String futureValue, double maxBalance, double minPurchase, double discountPercent) { app.addDiscountGroup(futureValue,maxBalance, minPurchase,discountPercent); } } |