Search in sources :

Example 6 with JsonString

use of elemental.json.JsonString in project che by eclipse.

the class JsonRpcResultTest method shouldToStringWhenParsingStringWithResultAsASingleString.

@Test
public void shouldToStringWhenParsingStringWithResultAsASingleString() throws Exception {
    JsonString string = jsonFactory.create("a");
    String expected = string.toJson();
    JsonRpcResult jsonRpcResult = new JsonRpcResult(string.toJson(), jsonFactory, dtoFactory);
    String actual = jsonRpcResult.toString();
    assertEquals(expected, actual);
}
Also used : JsonString(elemental.json.JsonString) JsonString(elemental.json.JsonString) Test(org.junit.Test)

Example 7 with JsonString

use of elemental.json.JsonString in project che by eclipse.

the class JsonRpcParamsTest method shouldToJsonValueForParsedSingleDtoParams.

@Test
public void shouldToJsonValueForParsedSingleDtoParams() throws Exception {
    JsonString expected = jsonFactory.create(DTO_JSON);
    JsonRpcParams jsonRpcParams = new JsonRpcParams(DTO_JSON, dtoFactory, jsonFactory);
    JsonValue actual = jsonRpcParams.toJsonValue();
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonValue(elemental.json.JsonValue) JsonString(elemental.json.JsonString) Test(org.junit.Test)

Example 8 with JsonString

use of elemental.json.JsonString in project che by eclipse.

the class JsonRpcResultTest method shouldToJsonValueWhenPassingParametersWithResultAsASingleString.

@Test
public void shouldToJsonValueWhenPassingParametersWithResultAsASingleString() throws Exception {
    String value = "a";
    JsonString expected = jsonFactory.create("a");
    JsonRpcResult jsonRpcResult = new JsonRpcResult(value, dtoFactory, jsonFactory);
    JsonValue actual = jsonRpcResult.toJsonValue();
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonValue(elemental.json.JsonValue) JsonString(elemental.json.JsonString) JsonString(elemental.json.JsonString) Test(org.junit.Test)

Aggregations

JsonString (elemental.json.JsonString)8 Test (org.junit.Test)8 JsonValue (elemental.json.JsonValue)4 JsonArray (elemental.json.JsonArray)3