Author: pete.muir(a)jboss.org
Date: 2008-06-06 17:12:45 -0400 (Fri, 06 Jun 2008)
New Revision: 8344
Added:
branches/Seam_2_0/src/test/mail/unit/
branches/Seam_2_0/src/test/mail/unit/org/
branches/Seam_2_0/src/test/mail/unit/org/jboss/
branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/
branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/
branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/
branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/
branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/HeaderTest.java
branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml
Log:
Backport JBSEAM-3071
Added: branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/HeaderTest.java
===================================================================
--- branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/HeaderTest.java
(rev 0)
+++
branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/HeaderTest.java 2008-06-06
21:12:45 UTC (rev 8344)
@@ -0,0 +1,105 @@
+package org.jboss.seam.test.mail.unit;
+
+import org.jboss.seam.mail.ui.Header;
+import org.testng.annotations.Test;
+
+public class HeaderTest
+{
+ @Test
+ public void testHeader()
+ {
+ String name = "foo";
+ String value = "bar";
+
+ Header header = new Header(name, value);
+
+ assert header.getSanitizedName().equals(name);
+ assert header.getSanitizedValue().equals(value);
+ }
+
+ @Test
+ public void testHeaderWithLineFeed()
+ {
+ String name = "foo\nnewline";
+ String value = "bar\nnewline";
+
+ Header header = new Header(name, value);
+
+ assert !header.getSanitizedName().equals(name);
+ assert !header.getSanitizedValue().equals(value);
+
+ assert "foo".equals(header.getSanitizedName());
+ assert "bar".equals(header.getSanitizedValue());
+ }
+
+ @Test
+ public void testHeaderWithCarrigeReturnLineBreak()
+ {
+ String name = "foo\r\nnewline";
+ String value = "bar\r\nnewline";
+
+ Header header = new Header(name, value);
+
+ assert !header.getSanitizedName().equals(name);
+ assert !header.getSanitizedValue().equals(value);
+
+ assert "foo".equals(header.getSanitizedName());
+ assert "bar".equals(header.getSanitizedValue());
+ }
+
+ @Test
+ public void testHeaderWithCarriageReturn()
+ {
+ String name = "foo\rnewline";
+ String value = "bar\rnewline";
+
+ Header header = new Header(name, value);
+
+ assert !header.getSanitizedName().equals(name);
+ assert !header.getSanitizedValue().equals(value);
+
+ assert "foo".equals(header.getSanitizedName());
+ assert "bar".equals(header.getSanitizedValue());
+ }
+
+ @Test
+ public void testHeaderWithFolding1()
+ {
+ String name = "header";
+ String value = "\"Joe & J. Harvey\" <ddd @ Org>,\n JJV @
BBN";
+ String sanitizedValue = "\"Joe & J. Harvey\" <ddd @ Org>,
JJV @ BBN";
+
+ Header header = new Header(name, value);
+
+ assert header.getSanitizedName().equals(name);
+ assert header.getSanitizedValue().equals(sanitizedValue);
+
+ }
+
+ @Test
+ public void testHeaderWithFolding2()
+ {
+ String name = "header";
+ String value = "\"Joe & J. Harvey\"\n <ddd @ Org>, JJV\n @
BBN";
+ String sanitizedValue = "\"Joe & J. Harvey\" <ddd @ Org>,
JJV @ BBN";
+
+ Header header = new Header(name, value);
+
+ assert header.getSanitizedName().equals(name);
+ assert header.getSanitizedValue().equals(sanitizedValue);
+
+ }
+
+ @Test
+ public void testHeaderWithFolding3()
+ {
+ String name = "header";
+ String value = "\"Joe &\n J. Harvey\" <ddd @ Org>, JJV @
BBN";
+ String sanitizedValue = "\"Joe & J. Harvey\" <ddd @ Org>,
JJV @ BBN";
+ Header header = new Header(name, value);
+
+ assert header.getSanitizedName().equals(name);
+ assert header.getSanitizedValue().equals(sanitizedValue);
+
+ }
+}
Property changes on:
branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/HeaderTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml
===================================================================
--- branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml
(rev 0)
+++
branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml 2008-06-06
21:12:45 UTC (rev 8344)
@@ -0,0 +1,9 @@
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+
+<suite name="Seam Mail Unit Testsuite" verbose="2"
parallel="false">
+ <test name="Seam Unit Tests: Mail">
+ <classes>
+ <class name="org.jboss.seam.test.mail.unit.HeaderTest"/>
+ </classes>
+ </test>
+</suite>
Property changes on:
branches/Seam_2_0/src/test/mail/unit/org/jboss/seam/test/mail/unit/testng.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Show replies by date