Save This Page
Home » apache-tomcat-6.0.16-src » javax » mail » internet » [javadoc | source]
    1   /**
    2    *
    3    * Copyright 2003-2004 The Apache Software Foundation
    4    *
    5    *  Licensed under the Apache License, Version 2.0 (the "License");
    6    *  you may not use this file except in compliance with the License.
    7    *  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   
   18   package javax.mail.internet;
   19   import junit.framework.TestCase;
   20   
   21   /**
   22    * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
   23    */
   24   public class ContentDispositionTest extends TestCase {
   25   
   26       public ContentDispositionTest(String name) {
   27           super(name);
   28       }
   29       
   30       public void testContentDisposition() throws ParseException {
   31           ContentDisposition c;
   32           c = new ContentDisposition();
   33           assertNotNull(c.getParameterList());
   34           assertNull(c.getParameterList().get("nothing"));
   35           assertNull(c.getDisposition());
   36           assertNull(c.toString());
   37           c.setDisposition("inline");
   38           assertEquals("inline",c.getDisposition());
   39           c.setParameter("file","file.txt");
   40           assertEquals("file.txt",c.getParameterList().get("file"));
   41           assertEquals("inline;file=file.txt",c.toString());
   42           c = new ContentDisposition("inline");
   43           assertEquals(0,c.getParameterList().size());
   44           assertEquals("inline",c.getDisposition());
   45           c = new ContentDisposition("inline",new ParameterList("charset=us-ascii;content-type=text/plain"));
   46           assertEquals("inline",c.getDisposition());
   47           assertEquals("us-ascii",c.getParameter("charset"));
   48           assertEquals("text/plain",c.getParameter("content-type"));
   49           c = new ContentDisposition("attachment;content-type=text/html;charset=UTF-8");
   50           assertEquals("attachment",c.getDisposition());
   51           assertEquals("UTF-8",c.getParameter("charset"));
   52           assertEquals("text/html",c.getParameter("content-type"));
   53       }
   54   
   55   }

Save This Page
Home » apache-tomcat-6.0.16-src » javax » mail » internet » [javadoc | source]