use of org.testng.annotations.Test in project che by eclipse.
the class JsonRpcParamsTest method shouldToJsonForCreatedListDtoParams.
@Test
public void shouldToJsonForCreatedListDtoParams() throws Exception {
List<Dto> list = singletonList(dto);
JsonArray expected = new JsonArray();
JsonElement element = jsonParser.parse(dto.toString());
expected.add(element);
JsonRpcParams jsonRpcParams = new JsonRpcParams(list, jsonParser);
JsonElement actual = jsonRpcParams.toJsonElement();
assertEquals(expected, actual);
}
use of org.testng.annotations.Test in project che by eclipse.
the class JsonRpcParamsTest method shouldToStringForParsedListDtoParams.
@Test
public void shouldToStringForParsedListDtoParams() throws Exception {
JsonArray array = new JsonArray();
JsonObject jsonObject = jsonParser.parse(DTO_JSON).getAsJsonObject();
array.add(jsonObject);
String expected = array.toString();
JsonRpcParams jsonRpcParams = new JsonRpcParams("[" + DTO_JSON + "]", jsonParser);
String actual = jsonRpcParams.toString();
assertEquals(expected, actual);
}
use of org.testng.annotations.Test in project che by eclipse.
the class JsonRpcParamsTest method shouldGetAsListForParsedListStringParams.
@Test
public void shouldGetAsListForParsedListStringParams() throws Exception {
String expected = "value";
JsonRpcParams jsonRpcParams = new JsonRpcParams("[\"" + expected + "\"]", jsonParser);
List<String> actual = jsonRpcParams.getAsListOf(String.class);
assertEquals(singletonList(expected), actual);
}
use of org.testng.annotations.Test in project che by eclipse.
the class JsonRpcParamsTest method shouldToStringCreatedListStringParams.
@Test
public void shouldToStringCreatedListStringParams() throws Exception {
String value = "value";
JsonArray array = new JsonArray();
array.add(new JsonPrimitive(value));
String expected = array.toString();
JsonRpcParams jsonRpcParams = new JsonRpcParams(singletonList(value), jsonParser);
String actual = jsonRpcParams.toString();
assertEquals(expected, actual);
}
use of org.testng.annotations.Test in project che by eclipse.
the class JsonRpcParamsTest method shouldToJsonValueForParsedListDoubleParams.
@Test
public void shouldToJsonValueForParsedListDoubleParams() throws Exception {
Double expected = 0D;
JsonArray array = new JsonArray();
array.add(new JsonPrimitive(expected));
JsonRpcParams jsonRpcParams = new JsonRpcParams("[" + expected + "]", jsonParser);
JsonElement jsonValue = jsonRpcParams.toJsonElement();
assertEquals(array, jsonValue);
}
Aggregations