@Test
public void testUpdateEventsMetadata() throws Exception {

  String metadataJson = IOUtils.toString(getClass().getResource("/eventMetadata.json"));
  given().formParam("eventIds", "[\"exists\", \"exists2\"]").formParam("metadata", metadataJson).expect()
    .statusCode(HttpStatus.SC_NO_CONTENT).when().put(rt.host("events/metadata"));
  String updateErrors = IOUtils.toString(getClass().getResource("/eventsMetadataUpdateErrors.json"));
  String result = given().formParam("eventIds", "[\"notExists\", \"exists\", \"updateFailure\"]").
    formParam("metadata", "metadata").expect().statusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR).when()
    .put(rt.host("events/metadata")).asString();
  assertThat(updateErrors, SameJSONAs.sameJSONAs(result));
}