Back to project page watchme.
The source code is released under:
Copyright (c) 2012 Johan Brook, Robin Andersson, Lisa Stenberg, Mattias Henriksson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documen...
If you think the Android project watchme listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package se.chalmers.watchmetest.net; /*w w w. j av a 2s . co m*/ import java.io.IOException; import junit.framework.TestCase; import se.chalmers.watchme.net.HttpRetriever; import se.chalmers.watchme.net.NoEntityException; /** * HttpRetrieverTest.java * * @author Johan */ public class HttpRetrieverTest extends TestCase { private HttpRetriever http; public void setUp() throws Exception { http = new HttpRetriever(); } public void testGetURL() { String response; try { response = http.get("http://google.com"); assertNotNull(response); } catch (IOException e) { e.printStackTrace(); } catch (NoEntityException e) { e.printStackTrace(); } } public void testIncorrectURL() { String response; try { response = http.get("http://www.google.com/404"); assertNull(response); } catch (IOException e) { e.printStackTrace(); } catch (NoEntityException e) { e.printStackTrace(); } } }