use of elemental.json.JsonNumber in project che by eclipse.
the class JsonRpcResultTest method shouldToJsonValueWhenParsingStringWithResultAsASingleNumber.
@Test
public void shouldToJsonValueWhenParsingStringWithResultAsASingleNumber() throws Exception {
Double number = 0D;
JsonNumber expected = jsonFactory.create(number);
JsonRpcResult jsonRpcResult = new JsonRpcResult(expected.toJson(), jsonFactory, dtoFactory);
JsonValue actual = jsonRpcResult.toJsonValue();
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonNumber in project che by eclipse.
the class JsonRpcResultTest method shouldToStringWhenParsingStringWithResultAsASingleNumber.
@Test
public void shouldToStringWhenParsingStringWithResultAsASingleNumber() throws Exception {
Double expected = 0D;
JsonNumber string = jsonFactory.create(expected);
JsonRpcResult jsonRpcResult = new JsonRpcResult(string.toJson(), jsonFactory, dtoFactory);
String actual = jsonRpcResult.toString();
assertEquals(expected, Double.valueOf(actual));
}
use of elemental.json.JsonNumber in project che by eclipse.
the class JsonRpcResultTest method shouldGetAsListOfNumberWhenParsingStringWithResultAsListOfNumber.
@Test
public void shouldGetAsListOfNumberWhenParsingStringWithResultAsListOfNumber() throws Exception {
Double expected = 0D;
JsonNumber string = jsonFactory.create(expected);
JsonArray array = jsonFactory.createArray();
array.set(0, string);
JsonRpcResult jsonRpcResult = new JsonRpcResult(array.toJson(), jsonFactory, dtoFactory);
List<Double> actual = jsonRpcResult.getAsListOf(Double.class);
assertEquals(expected, actual.iterator().next());
}
use of elemental.json.JsonNumber in project che by eclipse.
the class JsonRpcResultTest method shouldGetAsListOfNumberWhenPassingParametersWithResultAsListOfNumber.
@Test
public void shouldGetAsListOfNumberWhenPassingParametersWithResultAsListOfNumber() throws Exception {
Double expected = 0D;
JsonNumber string = jsonFactory.create(expected);
JsonArray array = jsonFactory.createArray();
array.set(0, string);
JsonRpcResult jsonRpcResult = new JsonRpcResult(singletonList(expected), jsonFactory, dtoFactory);
List<Double> actual = jsonRpcResult.getAsListOf(Double.class);
assertEquals(expected, actual.iterator().next());
}
use of elemental.json.JsonNumber in project che by eclipse.
the class JsonRpcResultTest method shouldToStringWhenParsingStringWithResultAsAListOfNumber.
@Test
public void shouldToStringWhenParsingStringWithResultAsAListOfNumber() throws Exception {
JsonNumber number = jsonFactory.create(0D);
JsonArray array = jsonFactory.createArray();
array.set(0, number);
String expected = array.toJson();
JsonRpcResult jsonRpcResult = new JsonRpcResult(array.toJson(), jsonFactory, dtoFactory);
String actual = jsonRpcResult.toString();
assertEquals(expected, actual);
}
Aggregations