Author: jbq
Date: Fri Mar  2 02:54:32 2007
New Revision: 513699

URL: http://svn.apache.org/viewvc?view=rev&rev=513699
Log:
* Use startsWith() in assertions to cope with optional charset
* Check that the Content-Disposition header exists

Modified:
    
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/link/DownloadLinkTest.java

Modified: 
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/link/DownloadLinkTest.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/link/DownloadLinkTest.java?view=diff&rev=513699&r1=513698&r2=513699
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/link/DownloadLinkTest.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket/src/test/java/wicket/markup/html/link/DownloadLinkTest.java
 Fri Mar  2 02:54:32 2007
@@ -38,7 +38,8 @@
        {
                tester.startPage(DownloadPage.class);
                tester.clickLink(DownloadPage.TEXT_DOWNLOAD_LINK);
-               assertEquals("text/plain", getContentType());
+               assertTrue(getContentType().startsWith("text/plain"));
+               assertTrue(getContentDisposition().startsWith("attachment; 
filename="));
                assertEquals(0, getContentLength());
        }
 
@@ -46,7 +47,7 @@
        {
                tester.startPage(DownloadPage.class);
                tester.clickLink(DownloadPage.PDF_DOWNLOAD_LINK);
-               assertEquals("application/pdf", getContentType());
+               assertTrue(getContentType().startsWith("application/pdf"));
                assertEquals(DownloadPage.HELLO_WORLD.length(), 
getContentLength());
        }
 
@@ -56,7 +57,7 @@
                
((MockServletContext)tester.getApplication().getServletContext()).addMimeType("custom",
                                APPLICATION_X_CUSTOM);
                tester.clickLink(DownloadPage.CUSTOM_DOWNLOAD_LINK);
-               assertEquals(APPLICATION_X_CUSTOM, getContentType());
+               assertTrue(getContentType().startsWith(APPLICATION_X_CUSTOM));
        }
 
        private String getContentType()
@@ -69,5 +70,11 @@
        {
                return 
Integer.parseInt(((MockHttpServletResponse)tester.getWicketResponse()
                                
.getHttpServletResponse()).getHeader("Content-Length"));
+       }
+
+       private String getContentDisposition()
+       {
+               return 
((MockHttpServletResponse)tester.getWicketResponse().getHttpServletResponse())
+                               .getHeader("Content-Disposition");
        }
 }


Reply via email to