34.4. Date FormattingWhen Emily and Neo ran the first test, they expected it to fail with the incorrect date, as they had not yet altered the corresponding code in the application to use the new Clock. But instead, the test failed because of the format of the date values in the Fit table. The standard format for Date was incorrect because it included seconds. Emily extended the constructor in class StartApplication to call the DoFixture method registerParseDelegate(). This method specifies that Date values from the Fit tables are to be formatted without seconds, using a DateFormat, as shown in Listing 34.7. Listing 34.7. StartApplication.java (part 2)public class StartApplication extends DoFixture { private final DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm"); private RentEz rentEz; public StartApplication() throws Exception { // ... registerParseDelegate(Date.class,dateFormat); } // ... } |