Package com.mashape.unirest.http

Examples of com.mashape.unirest.http.JsonNode


    assertTrue(jsonResponse.getHeaders().size() > 0);
    assertTrue(jsonResponse.getBody().toString().length() > 0);
    assertFalse(jsonResponse.getRawBody() == null);
    assertEquals(200, jsonResponse.getStatus());
   
    JsonNode json = jsonResponse.getBody();
    assertFalse(json.isArray());
    assertNotNull(json.getObject());
    assertNotNull(json.getArray());
    assertEquals(1, json.getArray().length());
    assertNotNull(json.getArray().get(0));
  }
View Full Code Here


    assertTrue(jsonResponse.getHeaders().size() > 0);
    assertTrue(jsonResponse.getBody().toString().length() > 0);
    assertFalse(jsonResponse.getRawBody() == null);
    assertEquals(200, jsonResponse.getStatus());
   
    JsonNode json = jsonResponse.getBody();
    assertFalse(json.isArray());
    assertNotNull(json.getObject());
    assertNotNull(json.getArray());
    assertEquals(1, json.getArray().length());
    assertNotNull(json.getArray().get(0));
  }
View Full Code Here

        assertTrue(jsonResponse.getHeaders().size() > 0);
        assertTrue(jsonResponse.getBody().toString().length() > 0);
        assertFalse(jsonResponse.getRawBody() == null);
        assertEquals(200, jsonResponse.getStatus());
       
        JsonNode json = jsonResponse.getBody();
        assertFalse(json.isArray());
        assertNotNull(json.getObject());
        assertNotNull(json.getArray());
        assertEquals(1, json.getArray().length());
        assertNotNull(json.getArray().get(0));
       
        assertEquals("value1", json.getObject().getJSONObject("form").getString("param1"));
        assertEquals("bye", json.getObject().getJSONObject("form").getString("param2"));
       
        status = true;
        lock.countDown();
      }
     
View Full Code Here

    assertTrue(jsonResponse.getHeaders().size() > 0);
    assertTrue(jsonResponse.getBody().toString().length() > 0);
    assertFalse(jsonResponse.getRawBody() == null);
    assertEquals(200, jsonResponse.getStatus());
   
    JsonNode json = jsonResponse.getBody();
    assertFalse(json.isArray());
    assertNotNull(json.getObject());
    assertNotNull(json.getArray());
    assertEquals(1, json.getArray().length());
    assertNotNull(json.getArray().get(0));
    assertNotNull(json.getObject().getJSONObject("files"));
   
    assertEquals("This \nis \na \ntest \nfile", json.getObject().getJSONObject("files").getString("file"));
    assertEquals("Mark", json.getObject().getJSONObject("form").getString("name"));
  }
View Full Code Here

        assertTrue(response.getHeaders().size() > 0);
        assertTrue(response.getBody().toString().length() > 0);
        assertFalse(response.getRawBody() == null);
        assertEquals(200, response.getStatus());
       
        JsonNode json = response.getBody();
        assertFalse(json.isArray());
        assertNotNull(json.getObject());
        assertNotNull(json.getArray());
        assertEquals(1, json.getArray().length());
        assertNotNull(json.getArray().get(0));
       
        assertEquals("This \nis \na \ntest \nfile", json.getObject().getJSONObject("files").getString("file"));
        assertEquals("Mark", json.getObject().getJSONObject("form").getString("name"));
       
        status = true;
        lock.countDown();
      }
     
View Full Code Here

    assertTrue(jsonResponse.getHeaders().size() > 0);
    assertTrue(jsonResponse.getBody().toString().length() > 0);
    assertFalse(jsonResponse.getRawBody() == null);
    assertEquals(200, jsonResponse.getStatus());
   
    JsonNode json = jsonResponse.getBody();
    assertFalse(json.isArray());
    assertTrue(json.getObject().getBoolean("gzipped"));
  }
View Full Code Here

    assertTrue(jsonResponse.getHeaders().size() > 0);
    assertTrue(jsonResponse.getBody().toString().length() > 0);
    assertFalse(jsonResponse.getRawBody() == null);
    assertEquals(200, jsonResponse.getStatus());
   
    JsonNode json = jsonResponse.getBody();
    assertFalse(json.isArray());
    assertTrue(json.getObject().getBoolean("gzipped"));
  }
View Full Code Here

    assertTrue(jsonResponse.getHeaders().size() > 0);
    assertTrue(jsonResponse.getBody().toString().length() > 0);
    assertFalse(jsonResponse.getRawBody() == null);
    assertEquals(200, jsonResponse.getStatus());
   
    JsonNode json = jsonResponse.getBody();
    assertFalse(json.isArray());
    assertTrue(jsonResponse.getBody().getObject().getJSONObject("headers").has("X-Custom-Header"));
    assertEquals("hello", json.getObject().getJSONObject("headers").getString("X-Custom-Header"));
    assertTrue(jsonResponse.getBody().getObject().getJSONObject("headers").has("User-Agent"));
    assertEquals("foobar", json.getObject().getJSONObject("headers").getString("User-Agent"));

    jsonResponse = Unirest.get("http://httpbin.org/headers").asJson();
    assertTrue(jsonResponse.getBody().getObject().getJSONObject("headers").has("X-Custom-Header"));
    assertEquals("hello", jsonResponse.getBody().getObject().getJSONObject("headers").getString("X-Custom-Header"));
   
View Full Code Here

TOP

Related Classes of com.mashape.unirest.http.JsonNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.