commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] Created: (NET-198) FTPTimestampParserImpl#parseTimeStamp() is not fully testable
Date Sat, 08 Mar 2008 10:09:46 GMT
FTPTimestampParserImpl#parseTimeStamp() is not fully testable

                 Key: NET-198
             Project: Commons Net
          Issue Type: Bug
            Reporter: Sebb

The FTPTimestampParserImpl#parseTimeStamp() method is not fully testable, because it unconditionally
creates Calendar items using the current time.

In order to test for leap years and DST, the test code needs to be able to set arbitrary times.

I suggest adding a package-private method that takes an additional Calendar parameter, as

	Calendar parseTimestamp(String timestampStr, Calendar now) throws ParseException {
        // etc

This would replace the original code; the public interface would delegate to the package-private

	public Calendar parseTimestamp(String timestampStr) throws ParseException {
		Calendar now = Calendar.getInstance();
		return parseTimestamp(timestampStr, now);

Patch to follow.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message