final ObjectCollectionRepresentation collectionRepr = collectionJsonResp.getEntity();
assertThat(collectionRepr.getString("memberType"), is("collection"));
// self link
final LinkRepresentation selfLink = collectionRepr.getLinkWithRel(Rel.SELF);
assertThat(selfLink, isLink(client)
.httpMethod(RestfulHttpMethod.GET)
.href(endsWith("/objects/BSRL/64/collections/invisibleCollection"))
.returning(HttpStatusCode.OK));
// up link
final LinkRepresentation upLink = collectionRepr.getLinkWithRel(Rel.UP);
assertThat(upLink, isLink(client)
.httpMethod(RestfulHttpMethod.GET)
.href(endsWith("http://localhost:39393/objects/BSRL/64"))
.returning(HttpStatusCode.OK)
.type(RepresentationType.DOMAIN_OBJECT.getMediaType())
.title("Untitled Bus Rules Entity"));
//addto link
final LinkRepresentation addtoLink = collectionRepr.getLinkWithRel(Rel.ADD_TO);
assertThat(addtoLink, isLink(client)
.httpMethod(RestfulHttpMethod.POST)
.type(RepresentationType.OBJECT_COLLECTION.getMediaType())
.href(endsWith("/objects/BSRL/64/collections/invisibleCollection")));
assertThat(addtoLink.getArguments(), is(not(nullValue())));
assertThat(addtoLink.getArguments().isArray(), is(false));
assertThat(addtoLink.getArguments().size(), is(1));
//remove-from link
final LinkRepresentation removeFromLink = collectionRepr.getLinkWithRel(Rel.REMOVE_FROM);
assertThat(removeFromLink, isLink(client)
.httpMethod(RestfulHttpMethod.DELETE)
.type(RepresentationType.OBJECT_COLLECTION.getMediaType())
.href(endsWith("/objects/BSRL/64/collections/invisibleCollection")));
assertThat(removeFromLink.getArguments(), is(not(nullValue())));
assertThat(removeFromLink.getArguments().isArray(), is(false));
assertThat(removeFromLink.getArguments().size(), is(1));
// described by link
final LinkRepresentation describedByLink = collectionRepr.getLinkWithRel(Rel.DESCRIBEDBY);
assertThat(describedByLink, isLink(client)
.returning(HttpStatusCode.OK)
.responseEntityWithSelfHref(describedByLink.getHref()));
assertThat(collectionRepr.getArray("value").isArray(),is(true));
assertThat(collectionRepr.getExtensions(), isMap());
assertThat(collectionRepr.getExtensions().getString("collectionSemantics"), is("list"));