You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2014/12/11 16:59:13 UTC
svn commit: r1644686 - in
/commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser:
EnterpriseUnixFTPEntryParserTest.java UnixFTPEntryParserTest.java
VMSFTPEntryParserTest.java
Author: sebb
Date: Thu Dec 11 15:59:13 2014
New Revision: 1644686
URL: http://svn.apache.org/r1644686
Log:
Simplify by using common test method
Modified:
commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParserTest.java
commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java
commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParserTest.java
Modified: commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParserTest.java?rev=1644686&r1=1644685&r2=1644686&view=diff
==============================================================================
--- commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParserTest.java (original)
+++ commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParserTest.java Thu Dec 11 15:59:13 2014
@@ -121,21 +121,11 @@ public class EnterpriseUnixFTPEntryParse
}
public void testPrecisionMinutes() {
- FTPFile file = getParser().parseFTPEntry("-C--E-----FTP B QUA1I1 18128 5000000000 Aug 12 13:56 QUADTEST");
- assertNotNull(file);
- Calendar stamp = file.getTimestamp();
- assertNotNull(stamp);
- assertTrue("Expected minute to be set", stamp.isSet(Calendar.MINUTE));
- assertFalse("Expected second to be unset", stamp.isSet(Calendar.SECOND));
+ testPrecision("-C--E-----FTP B QUA1I1 18128 5000000000 Aug 12 13:56 QUADTEST", CalendarUnit.MINUTE);
}
public void testPrecisionDays() {
- FTPFile file = getParser().parseFTPEntry("-C--E-----FTP B QUA1I1 18128 5000000000 Aug 12 2014 QUADTEST");
- assertNotNull(file);
- Calendar stamp = file.getTimestamp();
- assertNotNull(stamp);
- assertTrue("Expected day to be set", stamp.isSet(Calendar.DAY_OF_MONTH));
- assertFalse("Expected hour to be unset", stamp.isSet(Calendar.HOUR_OF_DAY));
+ testPrecision("-C--E-----FTP B QUA1I1 18128 5000000000 Aug 12 2014 QUADTEST", CalendarUnit.DAY_OF_MONTH);
}
/**
Modified: commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java?rev=1644686&r1=1644685&r2=1644686&view=diff
==============================================================================
--- commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java (original)
+++ commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParserTest.java Thu Dec 11 15:59:13 2014
@@ -248,21 +248,11 @@ public class UnixFTPEntryParserTest exte
public void testPrecisionMinutes() {
- FTPFile file = getParser().parseFTPEntry("drwxr-xr-x 2 user group 4096 Mar 2 15:13 zxbox");
- assertNotNull(file);
- Calendar stamp = file.getTimestamp();
- assertNotNull(stamp);
- assertTrue("Expected minute to be set", stamp.isSet(Calendar.MINUTE));
- assertFalse("Expected second to be unset", stamp.isSet(Calendar.SECOND));
+ testPrecision("drwxr-xr-x 2 user group 4096 Mar 2 15:13 zxbox", CalendarUnit.MINUTE);
}
public void testPrecisionDays() {
- FTPFile file = getParser().parseFTPEntry("drwxr-xr-x 2 user group 4096 Mar 2 2014 zxbox");
- assertNotNull(file);
- Calendar stamp = file.getTimestamp();
- assertNotNull(stamp);
- assertTrue("Expected day to be set", stamp.isSet(Calendar.DAY_OF_MONTH));
- assertFalse("Expected hour to be unset", stamp.isSet(Calendar.HOUR_OF_DAY));
+ testPrecision("drwxr-xr-x 2 user group 4096 Mar 2 2014 zxbox", CalendarUnit.DAY_OF_MONTH);
}
private void checkPermissions(FTPFile f) {
Modified: commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParserTest.java?rev=1644686&r1=1644685&r2=1644686&view=diff
==============================================================================
--- commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParserTest.java (original)
+++ commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParserTest.java Thu Dec 11 15:59:13 2014
@@ -18,7 +18,6 @@ package org.apache.commons.net.ftp.parse
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.util.Calendar;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPFileEntryParser;
@@ -206,13 +205,7 @@ public class VMSFTPEntryParserTest exten
}
public void testPrecisionSeconds() {
- FTPFile file = getParser().parseFTPEntry("1-JUN.LIS;1 9/9 2-JUN-1998 07:32:04 [TRANSLATED] (RWED,RD,,)");
- assertNotNull(file);
- Calendar stamp = file.getTimestamp();
- assertNotNull(stamp);
- assertTrue("Expected hour to be set", stamp.isSet(Calendar.HOUR_OF_DAY));
- assertTrue("Expected second to be set", stamp.isSet(Calendar.SECOND));
- assertFalse("Expected millisecond to be unset", stamp.isSet(Calendar.MILLISECOND));
+ testPrecision("1-JUN.LIS;1 9/9 2-JUN-1998 07:32:04 [TRANSLATED] (RWED,RD,,)", CalendarUnit.SECOND);
}
@Override