use of com.jayway.restassured.path.json.JsonPath in project opencast by opencast.
the class JsonConvTest method testManagedAclFull.
@Test
public void testManagedAclFull() {
String json = JsonConv.full(macl).toJson();
logger.info(json);
JsonPath jp = from(json);
assertEquals(4, ((Map) jp.get()).size());
assertEquals(new Integer(1), jp.get("id"));
assertEquals("default_org", jp.get("organizationId"));
assertEquals("Public", jp.get("name"));
assertEquals(1, ((List) jp.get("acl.ace")).size());
}
use of com.jayway.restassured.path.json.JsonPath in project opencast by opencast.
the class JsonsTest method testComposition4.
@Test
public void testComposition4() {
final Jsons.Arr j = append(arr(v("hallo"), ZERO_VAL, v("hello")), arr(v("hola")));
final JsonPath p = JsonPath.from(toJson(j));
assertThat(p.<String>getList(""), contains("hallo", "hello", "hola"));
}
use of com.jayway.restassured.path.json.JsonPath in project opencast by opencast.
the class JsonsTest method testComposition2.
@Test
public void testComposition2() {
final Jsons.Obj x = obj(p("name", "Karl"), p("city", "Paris"));
final Jsons.Obj y = obj(p("name", "Peter"));
final JsonPath p = JsonPath.from(toJson(append(x, y)));
assertEquals("Peter", p.get("name"));
assertEquals("Paris", p.get("city"));
}
use of com.jayway.restassured.path.json.JsonPath in project opencast by opencast.
the class JsonsTest method testComposition1.
@Test
public void testComposition1() {
final Jsons.Obj j = append(obj(p("name", "Karl"), p("city", "Paris"), p("remove_me", ZERO_VAL)), obj(p("age", 79)));
final JsonPath p = JsonPath.from(toJson(j));
logger.info(p.prettyPrint());
assertEquals("Karl", p.get("name"));
assertEquals("Paris", p.get("city"));
assertNull(p.get("remove_me"));
assertEquals(new Integer(79), p.get("age"));
}
use of com.jayway.restassured.path.json.JsonPath in project webcert by sklintyg.
the class BaseRestIntegrationTest method createArendeQuestion.
/**
* Inserts a question of type arende for an existing certificate
*
* @param intygTyp
* type to create
* @param intygsId
* id of the intyg to create the arende for
* @param personnummer
* patient to create it for
* @return
*/
protected String createArendeQuestion(String intygTyp, String intygsId, String personnummer, ArendeAmne messageType) {
Arende arende;
switch(messageType) {
case AVSTMN:
arende = createAvstamningArendeFromFktoWebcertUser(intygTyp, intygsId, personnummer);
break;
case KOMPLT:
arende = createKompletteringArendeFromFkToWebcertUser(intygTyp, intygsId, personnummer);
break;
default:
throw new IllegalArgumentException();
}
Response response = given().cookie("ROUTEID", BaseRestIntegrationTest.routeId).contentType(ContentType.JSON).body(arende).expect().statusCode(200).when().post("testability/arendetest").then().extract().response();
JsonPath model = new JsonPath(response.body().asString());
return model.get("meddelandeId");
}
Aggregations