import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.TableCell;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebLink;
import junit.framework.TestCase;
import junit.framework.TestSuite;


public class Spiegel extends TestCase {


	public static void main(String args[]) {
		junit.textui.TestRunner.run(suite());
	}

	public static TestSuite suite() {
		return new TestSuite(Spiegel.class);
	}

	public Spiegel(String s) {
		super(s);
	}

	public void testSpiegel() throws Exception {
		WebConversation webConversation = new WebConversation();
                WebRequest  webRequest = null;
                WebResponse webResponse = null;

                String url  = null;
                WebResponse homepage = webConversation.getResponse("http://www.spiegel.de");
		try {
		   assertEquals(200,homepage.getResponseCode());
		   String[] copyrightContentValue = homepage.getMetaTagContent("name", "copyright"); 
		   assertTrue(copyrightContentValue.length == 1); 
		   assertEquals("SPIEGEL ONLINE, Hamburg, Germany", copyrightContentValue[0]); 
  		   System.out.println("Content Value: " + copyrightContentValue[0]);
		   WebLink TestLink = homepage.getLinkWith("Politik");
		   assertNotNull(TestLink);
		   WebResponse TestPage = TestLink.click();
		   assertEquals(200, TestPage.getResponseCode()); 
                   }
		catch (Exception e) { System.out.println(e.toString()); } 
	}

}