public void invokeNonIdempotent_returningVoid_withReferenceArgs_usingClientFollow() throws Exception {
// given simple entity with 'flag' property set to true
final LinkRepresentation linkToSimpleEntity = givenLinkToSimpleEntity(0);
final RestfulResponse<DomainObjectRepresentation> restfulResponseBefore = client.followT(linkToSimpleEntity);
final DomainObjectRepresentation simpleEntityBefore = restfulResponseBefore.getEntity();
final Boolean before = simpleEntityBefore.getProperty("flag").getBoolean("value");
// and given 'toggle' action on repo
final JsonRepresentation givenAction = givenAction("simples", "toggle");
final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
// when
final LinkRepresentation invokeLink = actionRepr.getInvoke();
// then
assertThat(invokeLink, is(not(nullValue())));
final JsonRepresentation args = invokeLink.getArguments();
assertThat(args.size(), is(1));
assertThat(args.mapHas("object"), is(true));
// when
args.mapPut("object", linkToSimpleEntity);
final RestfulResponse<JsonRepresentation> restfulResponse = client.followT(invokeLink, args);
// then
assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NO_CONTENT));
// and then simple entity 'flag' property set to false
final RestfulResponse<DomainObjectRepresentation> restfulResponseAfter = client.followT(linkToSimpleEntity);
final DomainObjectRepresentation simpleEntityAfter = restfulResponseAfter.getEntity();
final Boolean after = simpleEntityAfter.getProperty("flag").getBoolean("value");
assertThat(after, is(!before)); // ie has been toggled
}