use of com.eclipsesource.json.JsonValue in project abstools by abstools.
the class ErlangModelApiTests method test_floatList.
@Test
public void test_floatList() throws IOException {
JsonObject parameter = Json.object().add("p", Json.array(1.1, 2.2, 3.3));
String response = sendPostRequest("/call/test/test_list_float", parameter.toString(), 200);
JsonValue result = getValueFromResponse(response);
JsonArray array = result.asArray();
Assert.assertEquals(1.1, array.get(0).asFloat(), 0.001);
Assert.assertEquals(2.2, array.get(1).asFloat(), 0.001);
Assert.assertEquals(3.3, array.get(2).asFloat(), 0.001);
}
use of com.eclipsesource.json.JsonValue in project abstools by abstools.
the class ErlangModelApiTests method test_intList.
@Test
public void test_intList() throws IOException {
JsonObject parameter = Json.object().add("p", Json.array(1, 2, 3));
String response = sendPostRequest("/call/test/test_list_int", parameter.toString(), 200);
JsonValue result = getValueFromResponse(response);
JsonArray array = result.asArray();
Assert.assertEquals(1, array.get(0).asInt());
Assert.assertEquals(2, array.get(1).asInt());
Assert.assertEquals(3, array.get(2).asInt());
}
use of com.eclipsesource.json.JsonValue in project abstools by abstools.
the class ErlangModelApiTests method test_boolByJson.
@Test
public void test_boolByJson() throws IOException {
JsonObject parameter = Json.object().add("p", true);
String response = sendPostRequest("/call/test/test_bool", parameter, 200);
JsonValue result = getValueFromResponse(response);
boolean value = result.asBoolean();
Assert.assertTrue(value);
}
use of com.eclipsesource.json.JsonValue in project abstools by abstools.
the class ErlangModelApiTests method test_boolList.
@Test
public void test_boolList() throws IOException {
JsonObject parameter = Json.object().add("p", Json.array(true, false));
String response = sendPostRequest("/call/test/test_list_bool", parameter.toString(), 200);
JsonValue result = getValueFromResponse(response);
JsonArray array = result.asArray();
Assert.assertTrue(array.get(0).asBoolean());
Assert.assertFalse(array.get(1).asBoolean());
}
use of com.eclipsesource.json.JsonValue in project abstools by abstools.
the class ErlangModelApiTests method test_boolMap.
@Test
public void test_boolMap() throws IOException {
JsonObject parameter = Json.object().add("p", Json.object().add("a", true).add("b", false).add("c", true));
String response = sendPostRequest("/call/test/test_map_bool", parameter.toString(), 200);
JsonValue result = getValueFromResponse(response);
JsonObject object = result.asObject();
Assert.assertTrue(object.get("a").asBoolean());
Assert.assertFalse(object.get("b").asBoolean());
Assert.assertTrue(object.get("c").asBoolean());
}
Aggregations