Author: reto
Date: Mon Jan 11 14:46:12 2010
New Revision: 897883

URL: http://svn.apache.org/viewvc?rev=897883&view=rev
Log:
CLEREZZA-39: added test, removed unsused imports

Modified:
    
incubator/clerezza/issues/CLEREZZA-39/org.apache.clerezza.platform.xhtml2html/src/main/java/org/apache/clerezza/platform/xhtml2html/WrappedRequest.java
    
incubator/clerezza/issues/CLEREZZA-39/org.apache.clerezza.platform.xhtml2html/src/test/java/org/apache/clerezza/platform/xhtml2html/DocTypeSettingByteChannelTest.java

Modified: 
incubator/clerezza/issues/CLEREZZA-39/org.apache.clerezza.platform.xhtml2html/src/main/java/org/apache/clerezza/platform/xhtml2html/WrappedRequest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-39/org.apache.clerezza.platform.xhtml2html/src/main/java/org/apache/clerezza/platform/xhtml2html/WrappedRequest.java?rev=897883&r1=897882&r2=897883&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-39/org.apache.clerezza.platform.xhtml2html/src/main/java/org/apache/clerezza/platform/xhtml2html/WrappedRequest.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-39/org.apache.clerezza.platform.xhtml2html/src/main/java/org/apache/clerezza/platform/xhtml2html/WrappedRequest.java
 Mon Jan 11 14:46:12 2010
@@ -19,13 +19,10 @@
 package org.apache.clerezza.platform.xhtml2html;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 import org.wymiwyg.wrhapi.HandlerException;
 import org.wymiwyg.wrhapi.HeaderName;
 import org.wymiwyg.wrhapi.Request;
-import org.wymiwyg.wrhapi.util.AcceptHeaderEntry;
-import org.wymiwyg.wrhapi.util.AcceptHeaderIterator;
 import org.wymiwyg.wrhapi.util.RequestWrapper;
 
 /**

Modified: 
incubator/clerezza/issues/CLEREZZA-39/org.apache.clerezza.platform.xhtml2html/src/test/java/org/apache/clerezza/platform/xhtml2html/DocTypeSettingByteChannelTest.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-39/org.apache.clerezza.platform.xhtml2html/src/test/java/org/apache/clerezza/platform/xhtml2html/DocTypeSettingByteChannelTest.java?rev=897883&r1=897882&r2=897883&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-39/org.apache.clerezza.platform.xhtml2html/src/test/java/org/apache/clerezza/platform/xhtml2html/DocTypeSettingByteChannelTest.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-39/org.apache.clerezza.platform.xhtml2html/src/test/java/org/apache/clerezza/platform/xhtml2html/DocTypeSettingByteChannelTest.java
 Mon Jan 11 14:46:12 2010
@@ -52,6 +52,25 @@
                Assert.assertTrue(resultString.startsWith("<!DOCTYPE"));
        }
 
+       @Test
+       public void simpleTestNotHtml() throws Exception {
+               final String someHtml = "bla";
+               final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+               final WritableByteChannel channel = new 
DocTypeSettingByteChannel(Channels.newChannel(baos),
+                               new ResponseStatusInfo() {
+
+                       @Override
+                       public boolean isHtml() {
+                               return false;
+                       }
+
+               });
+               channel.write(ByteBuffer.wrap(someHtml.getBytes(UTF8)));
+               channel.close();
+               final String resultString = new String(baos.toByteArray(), 
UTF8);
+               Assert.assertFalse(resultString.startsWith("<!DOCTYPE"));
+       }
+
        /**
         * XML declaration allowed only at the start of the document
         */
@@ -134,6 +153,7 @@
 
                });
                channel.write(ByteBuffer.wrap(someHtml.getBytes(UTF8)));
+               channel.close();
                final String resultString = new String(baos.toByteArray(), 
UTF8);
                Assert.assertTrue(resultString.startsWith("<!DOCTYPE 
something"));
                
Assert.assertFalse(resultString.substring(8).contains("<!DOCTYPE"));


Reply via email to