This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-net.git
The following commit(s) were added to refs/heads/master by this push: new 68919acd Add org.apache.commons.net.ftp.parser.FTPTimestampParserImplTest.testNet710() 68919acd is described below commit 68919acdee9daf21e98f23e15ffc1ef1f7a285a9 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat May 4 18:01:07 2024 -0400 Add org.apache.commons.net.ftp.parser.FTPTimestampParserImplTest.testNet710() --- .../net/ftp/parser/FTPTimestampParserImplTest.java | 34 +++++++++++++--------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java b/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java index fe0d58f9..4faa822b 100644 --- a/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java +++ b/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java @@ -99,17 +99,6 @@ public class FTPTimestampParserImplTest { } } - // This test currently fails, because we assume that short dates are +-6months when parsing Feb 29 - @Test - @Disabled - public void testNET446() throws Exception { - final GregorianCalendar server = new GregorianCalendar(2001, Calendar.JANUARY, 1, 12, 0); - // Note: we use a known leap year for the target date to avoid rounding up - final GregorianCalendar input = new GregorianCalendar(2000, Calendar.FEBRUARY, 29); - final GregorianCalendar expected = new GregorianCalendar(2000, Calendar.FEBRUARY, 29); - checkShortParse("Feb 29th 2000", server, input, expected); - } - // Test leap year if current year is a leap year @Test public void testFeb29IfLeapYear() throws Exception { @@ -166,8 +155,6 @@ public class FTPTimestampParserImplTest { assertThrows(ParseException.class, () -> checkShortParse("Feb 29th 1999", server, input, expected, false)); } -// Lenient mode allows for dates up to 1 day in the future - @Test public void testNET444() throws Exception { final FTPTimestampParserImpl parser = new FTPTimestampParserImpl(); @@ -188,6 +175,27 @@ public class FTPTimestampParserImplTest { assertEquals(nowplus25.get(Calendar.YEAR) - 1, parsed25.get(Calendar.YEAR)); } +// Lenient mode allows for dates up to 1 day in the future + + // This test currently fails, because we assume that short dates are +-6months when parsing Feb 29 + @Test + @Disabled + public void testNET446() throws Exception { + final GregorianCalendar server = new GregorianCalendar(2001, Calendar.JANUARY, 1, 12, 0); + // Note: we use a known leap year for the target date to avoid rounding up + final GregorianCalendar input = new GregorianCalendar(2000, Calendar.FEBRUARY, 29); + final GregorianCalendar expected = new GregorianCalendar(2000, Calendar.FEBRUARY, 29); + checkShortParse("Feb 29th 2000", server, input, expected); + } + + @Test + @Disabled + public void testNet710() throws ParseException { + Calendar serverTime = Calendar.getInstance(TimeZone.getTimeZone("EDT"), Locale.US); + serverTime.set(2022, 2, 16, 14, 0); + new FTPTimestampParserImpl().parseTimestamp("Mar 13 02:33", serverTime); + } + @Test public void testParseDec31Lenient() throws Exception { final GregorianCalendar now = new GregorianCalendar(2007, Calendar.DECEMBER, 30, 12, 0);