Search in sources :

Example 61 with JsonObject

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

the class JsonRpcResponseTest method shouldToStringWhenPassingParametersWithError.

@Test
public void shouldToStringWhenPassingParametersWithError() throws Exception {
    JsonObject expected = response;
    expected.remove("result");
    JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(ID, null, error, jsonFactory);
    JsonValue actual = jsonFactory.parse(jsonRpcResponse.toString());
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonValue(elemental.json.JsonValue) JsonObject(elemental.json.JsonObject) Test(org.junit.Test)

Example 62 with JsonObject

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

the class JsonRpcResponseTest method shouldToStringWhenParsingStringWithError.

@Test
public void shouldToStringWhenParsingStringWithError() throws Exception {
    JsonObject expected = response;
    expected.remove("result");
    JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(expected.toJson(), jsonFactory, dtoFactory);
    JsonValue actual = jsonFactory.parse(jsonRpcResponse.toString());
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonValue(elemental.json.JsonValue) JsonObject(elemental.json.JsonObject) Test(org.junit.Test)

Example 63 with JsonObject

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

the class JsonRpcResponseTest method shouldToJsonObjectWhenPassingParametersWithResult.

@Test
public void shouldToJsonObjectWhenPassingParametersWithResult() throws Exception {
    JsonObject expected = response;
    expected.remove("error");
    JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(ID, result, null, jsonFactory);
    JsonObject actual = jsonRpcResponse.toJsonObject();
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonObject(elemental.json.JsonObject) Test(org.junit.Test)

Example 64 with JsonObject

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

the class JsonRpcResponseTest method shouldToStringWhenPassingParametersWithResult.

@Test
public void shouldToStringWhenPassingParametersWithResult() throws Exception {
    JsonObject expected = response;
    expected.remove("error");
    JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(ID, result, null, jsonFactory);
    JsonValue actual = jsonFactory.parse(jsonRpcResponse.toString());
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonValue(elemental.json.JsonValue) JsonObject(elemental.json.JsonObject) Test(org.junit.Test)

Example 65 with JsonObject

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

the class JsonRpcResponseTest method shouldToStringWhenParsingStringWithResult.

@Test
public void shouldToStringWhenParsingStringWithResult() throws Exception {
    JsonObject expected = response;
    expected.remove("error");
    JsonRpcResponse jsonRpcResponse = new JsonRpcResponse(expected.toJson(), jsonFactory, dtoFactory);
    JsonValue actual = jsonFactory.parse(jsonRpcResponse.toString());
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonValue(elemental.json.JsonValue) JsonObject(elemental.json.JsonObject) Test(org.junit.Test)

Aggregations

JsonObject (elemental.json.JsonObject)70 Test (org.junit.Test)49 JsonValue (elemental.json.JsonValue)19 JsonArray (elemental.json.JsonArray)14 JsonString (elemental.json.JsonString)5 PartPresenter (org.eclipse.che.ide.api.parts.PartPresenter)5 ArrayList (java.util.ArrayList)4 Matchers.anyString (org.mockito.Matchers.anyString)4 Promise (org.eclipse.che.api.promises.client.Promise)3 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)3 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)2 JsonException (elemental.json.JsonException)2 List (java.util.List)2 Map (java.util.Map)2 OperationException (org.eclipse.che.api.promises.client.OperationException)2 StateComponent (org.eclipse.che.ide.api.component.StateComponent)2 EditorPartStack (org.eclipse.che.ide.api.parts.EditorPartStack)2 Perspective (org.eclipse.che.ide.api.parts.Perspective)2 Before (org.junit.Before)2 ArrayOf (elemental.util.ArrayOf)1