* @author Kevin Conaway
*/
public class HttpCallTestCase extends RestletTestCase {
public void testFormatContentDisposition() {
Disposition disposition = new Disposition();
assertEquals("", DispositionWriter.write(disposition));
disposition = new Disposition(Disposition.TYPE_ATTACHMENT);
assertEquals("attachment", DispositionWriter.write(disposition));
disposition.setFilename("");
assertEquals("attachment; filename=", DispositionWriter
.write(disposition));
disposition.setFilename("test.txt");
assertEquals("attachment; filename=test.txt", DispositionWriter
.write(disposition));
disposition.setFilename("file with space.txt");
assertEquals("attachment; filename=\"file with space.txt\"",
DispositionWriter.write(disposition));
disposition.setType(Disposition.TYPE_INLINE);
assertEquals("inline; filename=\"file with space.txt\"",
DispositionWriter.write(disposition));
disposition.getParameters().clear();
Calendar c = new GregorianCalendar(Locale.ENGLISH);
c.set(Calendar.YEAR, 2009);
c.set(Calendar.MONTH, 10);
c.set(Calendar.DAY_OF_MONTH, 11);
c.set(Calendar.AM_PM, Calendar.AM);
c.set(Calendar.HOUR, 10);
c.set(Calendar.MINUTE, 11);
c.set(Calendar.SECOND, 12);
c.set(Calendar.MILLISECOND, 13);
c.setTimeZone(TimeZone.getTimeZone("GMT"));
disposition.setCreationDate(c.getTime());
assertEquals("inline; creation-date=\"Wed, 11 Nov 09 10:11:12 GMT\"",
DispositionWriter.write(disposition));
}