Author: antonio
Date: Sun May 1 08:39:38 2005
New Revision: 165517
URL: http://svn.apache.org/viewcvs?rev=165517&view=rev
Log:
Merging from 2.1
Modified:
cocoon/trunk/src/test/org/apache/cocoon/util/test/MIMEUtilsTestCase.java
Modified:
cocoon/trunk/src/test/org/apache/cocoon/util/test/MIMEUtilsTestCase.java
URL:
http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/util/test/MIMEUtilsTestCase.java?rev=165517&r1=165516&r2=165517&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/util/test/MIMEUtilsTestCase.java
(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/util/test/MIMEUtilsTestCase.java
Sun May 1 08:39:38 2005
@@ -29,16 +29,15 @@
* Specifically, code for testing the parsing of mime.types files.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jeff Turner</a>
- * @version CVS $Id: MIMEUtilsTestCase.java,v 1.4 2004/07/11 23:02:54 antonio
Exp $
+ * @version CVS $Id$
*/
public class MIMEUtilsTestCase extends TestCase
{
-
final String NL = SystemUtils.LINE_SEPARATOR;
Map mimeMap;
Map extMap;
- final String M2E = "MIME to extension mappings";
- final String E2M = "Extension to MIME mappings";
+ static final String M2E = "MIME to extension mappings";
+ static final String E2M = "Extension to MIME mappings";
public MIMEUtilsTestCase(String name) {
super(name);
@@ -48,12 +47,14 @@
junit.textui.TestRunner.run(MIMEUtilsTestCase.class);
}
- public void setUp() {
+ public void setUp() throws Exception {
+ super.setUp();
mimeMap = new HashMap();
extMap = new HashMap();
}
- public void tearDown() {
+ public void tearDown() throws Exception {
+ super.tearDown();
mimeMap = null;
extMap = null;
}
@@ -71,13 +72,13 @@
}
public void testTypicalUsage() throws Exception {
- String mime_types="# MIME type mappings"+NL+
- "text/plain txt text "+NL+
- "text/html html htm"+NL+
- " "+NL+
- "text/xml xml"+NL+
- "text/css css"+NL+
- "text/javascript js "+NL+
+ String mime_types="# MIME type mappings"+ NL +
+ "text/plain txt text "+ NL +
+ "text/html html htm"+ NL +
+ " "+ NL +
+ "text/xml xml"+ NL +
+ "text/css css"+ NL +
+ "text/javascript js "+ NL +
"application/x-javascript js";
MIMEUtils.loadMimeTypes(new StringReader(mime_types), extMap, mimeMap);
@@ -108,9 +109,8 @@
}
public void tstCommentsAndWhitespace() throws Exception {
- String NL = SystemUtils.LINE_SEPARATOR;
String mime_types="## A commented line"+NL+
- " "+NL+
+ " "+ NL +
"# Another comment";
MIMEUtils.loadMimeTypes(new StringReader(mime_types), extMap, mimeMap);
assertEquals(M2E, 0, extMap.size());
@@ -118,10 +118,9 @@
}
public void tstMimeTypeWithoutExtension() throws Exception {
- String NL = SystemUtils.LINE_SEPARATOR;
String mime_types=
- "text/plain txt text"+NL+
- "application/octet-stream"+NL+NL;
+ "text/plain txt text"+ NL +
+ "application/octet-stream"+ NL + NL;
MIMEUtils.loadMimeTypes(new StringReader(mime_types), extMap, mimeMap);
assertEquals(".txt", extMap.get("text/plain"));
assertEquals("text/plain", mimeMap.get(".txt"));
@@ -129,5 +128,4 @@
assertEquals(M2E, 1, extMap.size());
assertEquals(E2M, 2, mimeMap.size());
}
-
}