Search in sources :

Example 71 with JsonValue

use of elemental.json.JsonValue 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)

Example 72 with JsonValue

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

the class JsonRpcResultTest method shouldToJsonValueWhenPassingParametersWithResultAsASingleVoid.

@Test
public void shouldToJsonValueWhenPassingParametersWithResultAsASingleVoid() throws Exception {
    JsonObject expected = jsonFactory.createObject();
    JsonRpcResult jsonRpcResult = new JsonRpcResult(null, dtoFactory, jsonFactory);
    JsonValue actual = jsonRpcResult.toJsonValue();
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonValue(elemental.json.JsonValue) JsonObject(elemental.json.JsonObject) Test(org.junit.Test)

Example 73 with JsonValue

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

the class JsonRpcResultTest method shouldToJsonValueWhenParsingStringWithResultAsAListOfDto.

@Test
public void shouldToJsonValueWhenParsingStringWithResultAsAListOfDto() throws Exception {
    JsonArray expected = jsonFactory.createArray();
    JsonObject value = jsonFactory.parse(dto.toString());
    expected.set(0, value);
    JsonRpcResult jsonRpcResult = new JsonRpcResult(expected.toJson(), jsonFactory, dtoFactory);
    JsonValue actual = jsonRpcResult.toJsonValue();
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonArray(elemental.json.JsonArray) JsonValue(elemental.json.JsonValue) JsonObject(elemental.json.JsonObject) Test(org.junit.Test)

Example 74 with JsonValue

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

the class JsonRpcResultTest method shouldToJsonValueWhenPassingParametersWithResultAsASingleNumber.

@Test
public void shouldToJsonValueWhenPassingParametersWithResultAsASingleNumber() throws Exception {
    Double number = 0D;
    JsonNumber expected = jsonFactory.create(number);
    JsonRpcResult jsonRpcResult = new JsonRpcResult(number, dtoFactory, jsonFactory);
    JsonValue actual = jsonRpcResult.toJsonValue();
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonNumber(elemental.json.JsonNumber) JsonValue(elemental.json.JsonValue) Test(org.junit.Test)

Example 75 with JsonValue

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

the class JsonRpcResultTest method shouldToJsonValueWhenParsingStringWithResultAsASingleVoid.

@Test
public void shouldToJsonValueWhenParsingStringWithResultAsASingleVoid() throws Exception {
    JsonObject expected = jsonFactory.createObject();
    JsonRpcResult jsonRpcResult = new JsonRpcResult(expected.toJson(), jsonFactory, dtoFactory);
    JsonValue actual = jsonRpcResult.toJsonValue();
    assertTrue(expected.jsEquals(actual));
}
Also used : JsonValue(elemental.json.JsonValue) JsonObject(elemental.json.JsonObject) Test(org.junit.Test)

Aggregations

JsonValue (elemental.json.JsonValue)102 Test (org.junit.Test)76 JsonObject (elemental.json.JsonObject)46 JsonArray (elemental.json.JsonArray)31 JsonString (elemental.json.JsonString)11 JsonNull (elemental.json.JsonNull)7 Element (com.vaadin.flow.dom.Element)5 Matchers.anyString (org.mockito.Matchers.anyString)5 UI (com.vaadin.flow.component.UI)4 StateNode (com.vaadin.flow.internal.StateNode)4 JsonNumber (elemental.json.JsonNumber)4 StateNodeTest (com.vaadin.flow.internal.StateNodeTest)3 ArrayList (java.util.ArrayList)3 StateNode (com.vaadin.client.flow.StateNode)2 MapProperty (com.vaadin.client.flow.nodefeature.MapProperty)2 JsonSerializable (com.vaadin.flow.component.JsonSerializable)2 StateTree (com.vaadin.flow.internal.StateTree)2 AbstractNodeFeatureTest (com.vaadin.flow.internal.nodefeature.AbstractNodeFeatureTest)2 ElementData (com.vaadin.flow.internal.nodefeature.ElementData)2 Element (elemental.dom.Element)2