com.github.restdriver.serverdriver
Class Json

java.lang.Object
  extended by com.github.restdriver.serverdriver.Json

public final class Json
extends Object

Class supplying static methods to help with JSON representations.


Method Summary
static org.codehaus.jackson.JsonNode asJson(Response response)
          Converts the content of the response to a JSON node.
static org.codehaus.jackson.JsonNode asJson(String json)
          Converts the given string to a JSON node.
static org.hamcrest.TypeSafeMatcher<org.codehaus.jackson.JsonNode> containingValue(org.hamcrest.Matcher<?> matcher)
          Creates a new instance of ContainingValue.
static org.hamcrest.TypeSafeMatcher<org.codehaus.jackson.JsonNode> hasJsonArray(String fieldName, org.hamcrest.Matcher<?> matcher)
          Creates a new instance of HasJsonArray.
static org.hamcrest.TypeSafeMatcher<org.codehaus.jackson.JsonNode> hasJsonValue(String fieldName, org.hamcrest.Matcher<?> matcher)
          Creates a new instance of HasJsonValue.
static org.hamcrest.TypeSafeMatcher<org.codehaus.jackson.JsonNode> withSize(org.hamcrest.Matcher<?> matcher)
          Creates a new instance of WithSize.
static org.hamcrest.TypeSafeMatcher<org.codehaus.jackson.JsonNode> withValueAt(int position, org.hamcrest.Matcher<?> matcher)
          Creates a new instance of WithValueAt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

asJson

public static org.codehaus.jackson.JsonNode asJson(Response response)
Converts the content of the response to a JSON node.

Parameters:
response - The response whose content is to be converted
Returns:
The converted JSON node

asJson

public static org.codehaus.jackson.JsonNode asJson(String json)
Converts the given string to a JSON node.

Parameters:
json - The string which is to be converted
Returns:
The converted JSON node

hasJsonValue

public static org.hamcrest.TypeSafeMatcher<org.codehaus.jackson.JsonNode> hasJsonValue(String fieldName,
                                                                                       org.hamcrest.Matcher<?> matcher)
Creates a new instance of HasJsonValue.

Parameters:
fieldName - The name of the field in the JSON node which will be evaluated
matcher - The matcher to use for evaluation
Returns:
The new matcher

hasJsonArray

public static org.hamcrest.TypeSafeMatcher<org.codehaus.jackson.JsonNode> hasJsonArray(String fieldName,
                                                                                       org.hamcrest.Matcher<?> matcher)
Creates a new instance of HasJsonArray.

Parameters:
fieldName - The name of the field in the JSON node which will be evaluated
matcher - The matcher to use for evaluation
Returns:
The new matcher

containingValue

public static org.hamcrest.TypeSafeMatcher<org.codehaus.jackson.JsonNode> containingValue(org.hamcrest.Matcher<?> matcher)
Creates a new instance of ContainingValue.

Parameters:
matcher - The matcher to use for evaluation
Returns:
The new matcher

withValueAt

public static org.hamcrest.TypeSafeMatcher<org.codehaus.jackson.JsonNode> withValueAt(int position,
                                                                                      org.hamcrest.Matcher<?> matcher)
Creates a new instance of WithValueAt.

Parameters:
position - The position of the value to be evaluated
matcher - The matcher to use for evaluation
Returns:
The new matcher

withSize

public static org.hamcrest.TypeSafeMatcher<org.codehaus.jackson.JsonNode> withSize(org.hamcrest.Matcher<?> matcher)
Creates a new instance of WithSize.

Parameters:
matcher - The matcher to use for evaluation
Returns:
The new matcher


Copyright © 2011. All Rights Reserved.