commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1801388 - in /commons/proper/email/trunk/src: main/java/org/apache/commons/mail/ test/java/org/apache/commons/mail/
Date Sun, 09 Jul 2017 20:35:00 GMT
Author: ggregory
Date: Sun Jul  9 20:35:00 2017
New Revision: 1801388

URL: http://svn.apache.org/viewvc?rev=1801388&view=rev
Log:
Better names per Siegfried's suggestions.

Modified:
    commons/proper/email/trunk/src/main/java/org/apache/commons/mail/Email.java
    commons/proper/email/trunk/src/main/java/org/apache/commons/mail/EmailUtils.java
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailUtilsTest.java

Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/Email.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/main/java/org/apache/commons/mail/Email.java?rev=1801388&r1=1801387&r2=1801388&view=diff
==============================================================================
--- commons/proper/email/trunk/src/main/java/org/apache/commons/mail/Email.java (original)
+++ commons/proper/email/trunk/src/main/java/org/apache/commons/mail/Email.java Sun Jul  9
20:35:00 2017
@@ -1238,7 +1238,7 @@ public abstract class Email
      * @since 1.0
      */
     public Email setSubject(final String aSubject) {
-        this.subject = EmailUtils.clearEndOfLineCharacters(aSubject);
+        this.subject = EmailUtils.replaceEndOfLineCharactersWithSpaces(aSubject);
         return this;
     }
 

Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/EmailUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/main/java/org/apache/commons/mail/EmailUtils.java?rev=1801388&r1=1801387&r2=1801388&view=diff
==============================================================================
--- commons/proper/email/trunk/src/main/java/org/apache/commons/mail/EmailUtils.java (original)
+++ commons/proper/email/trunk/src/main/java/org/apache/commons/mail/EmailUtils.java Sun Jul
 9 20:35:00 2017
@@ -275,7 +275,7 @@ final class EmailUtils
      * @param input the input string to be URL scanned.
      * @return a clean string
      */
-    static String clearEndOfLineCharacters(final String input) {
+    static String replaceEndOfLineCharactersWithSpaces(final String input) {
         return input.replace('\n', ' ').replace('\r', ' ');
     }
     

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java?rev=1801388&r1=1801387&r2=1801388&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java
(original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java
Sun Jul  9 20:35:00 2017
@@ -96,7 +96,7 @@ public abstract class AbstractEmailTest
     };
 
     /** Test characters not acceptable to email */
-    protected String[] testCharsInvalid =
+    protected String[] endOfLineCombinations =
     {
             "\n",
             "\r",

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java?rev=1801388&r1=1801387&r2=1801388&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java Sun Jul
 9 20:35:00 2017
@@ -979,8 +979,8 @@ public class EmailTest extends AbstractE
     }
 
     @Test
-    public void testSetSubjectInvalid() {
-        for (final String invalidChar : testCharsInvalid) {
+    public void testEndOflineCharactersInSubjectAreReplacedWithSpaces() {
+        for (final String invalidChar : endOfLineCombinations) {
             email.setSubject(invalidChar);
             assertNotEquals(invalidChar, email.getSubject());
         }

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailUtilsTest.java?rev=1801388&r1=1801387&r2=1801388&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailUtilsTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailUtilsTest.java Sun
Jul  9 20:35:00 2017
@@ -32,11 +32,11 @@ public class EmailUtilsTest {
 
     @Test
     public void testClearEndOfLineCharacters() {
-        assertEquals("abcdefg", EmailUtils.clearEndOfLineCharacters("abcdefg"));
-        assertEquals("abc defg", EmailUtils.clearEndOfLineCharacters("abc\rdefg"));
-        assertEquals("abc defg", EmailUtils.clearEndOfLineCharacters("abc\ndefg"));
-        assertEquals("abc  defg", EmailUtils.clearEndOfLineCharacters("abc\r\ndefg"));
-        assertEquals("abc  defg", EmailUtils.clearEndOfLineCharacters("abc\n\rdefg"));
+        assertEquals("abcdefg", EmailUtils.replaceEndOfLineCharactersWithSpaces("abcdefg"));
+        assertEquals("abc defg", EmailUtils.replaceEndOfLineCharactersWithSpaces("abc\rdefg"));
+        assertEquals("abc defg", EmailUtils.replaceEndOfLineCharactersWithSpaces("abc\ndefg"));
+        assertEquals("abc  defg", EmailUtils.replaceEndOfLineCharactersWithSpaces("abc\r\ndefg"));
+        assertEquals("abc  defg", EmailUtils.replaceEndOfLineCharactersWithSpaces("abc\n\rdefg"));
     }
 
     @Test



Mime
View raw message