1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.attachment;
16
17 import java.net.URL;
18 import java.util.Collections;
19
20 import org.htmlunit.HttpMethod;
21 import org.htmlunit.Page;
22 import org.htmlunit.WebResponse;
23 import org.htmlunit.WebResponseData;
24 import org.htmlunit.http.HttpStatus;
25 import org.junit.Assert;
26 import org.junit.Test;
27
28
29
30
31
32
33 public class AttachmentHandlerTest {
34
35
36
37
38 @Test
39 public void noHeaders() throws Exception {
40 final WebResponseData data = new WebResponseData("HtmlUnit".getBytes(),
41 HttpStatus.OK_200, HttpStatus.OK_200_MSG, Collections.emptyList());
42 final WebResponse response = new WebResponse(data, new URL("http://test.com"), HttpMethod.GET, 1000);
43 final AttachmentHandler attachmentHandler = new AttachmentHandler() {
44
45 @Override
46 public void handleAttachment(final Page page, final String attachmentFilename) {
47
48 }
49 };
50
51 Assert.assertFalse(attachmentHandler.isAttachment(response));
52 }
53 }