Exemple #1
0
 @Test
 public void shouldWorkWithQueryStringParams() {
   Request request =
       new Request(Verb.GET, "http://stackoverflow.com/search?q=oauth+authentication&more=stuff");
   assertEquals(2, request.getQueryStringParams().size());
   assertEquals("http://stackoverflow.com/search", request.getSanitizedUrl());
   Response response = request.send();
   assertEquals(200, response.getCode());
   assertTrue(response.getBody().length() > 0);
 }
Exemple #2
0
 @Test
 public void shouldFollowRedirects() {
   Response response = new Request(Verb.GET, "http://bit.ly/whatsup").send();
   assertEquals(200, response.getCode());
   assertTrue(response.getBody().length() > 0);
 }
Exemple #3
0
 @Test
 public void shouldReturn404ForUnexistentUrls() {
   Response response = new Request(Verb.GET, "http://xkcd.com/404").send();
   assertEquals(404, response.getCode());
 }
Exemple #4
0
 @Test
 public void shouldReturn200WhenRequestIsOk() {
   Response response = new Request(Verb.GET, "http://www.google.com").send();
   assertEquals(200, response.getCode());
   assertTrue(response.getBody().length() > 0);
 }