KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > nutch > protocol > TestContent


1 /* Copyright (c) 2003 The Nutch Organization. All rights reserved. */
2 /* Use subject to the conditions in http://www.nutch.org/LICENSE.txt. */
3
4 package net.nutch.protocol;
5
6 import java.io.*;
7 import java.util.Properties JavaDoc;
8 import net.nutch.io.*;
9 import net.nutch.pagedb.*;
10 import junit.framework.TestCase;
11
12 /** Unit tests for Content. */
13
14 public class TestContent extends TestCase {
15   public TestContent(String JavaDoc name) { super(name); }
16
17   public void testContent() throws Exception JavaDoc {
18
19     String JavaDoc page = "<HTML><BODY><H1>Hello World</H1><P>The Quick Brown Fox Jumped Over the Lazy Fox.</BODY></HTML>";
20
21     String JavaDoc url = "http://www.foo.com/";
22
23     Properties JavaDoc metaData = new Properties JavaDoc();
24     metaData.put("Host", "www.foo.com");
25     metaData.put("Content-Type", "text/html");
26
27     Content r = new Content(url, url, page.getBytes("UTF8"), "text/html",
28                             metaData);
29                         
30     TestWritable.testWritable(r);
31   }
32     
33 }
34
Popular Tags