+ "]}");
assertThat(response.stream().status()).isEqualTo(400);
assertThat(response.stream().mediaType()).isEqualTo(MediaTypes.JSON);
}
@Test
<BUG>public void render_real_exception_when_failing_to_write_json_errors() {
ValidatingRequest request = new TestRequest().setMethod("GET").setPath("/api/system/fail_to_write_errors");
</BUG>
DumbResponse response = new DumbResponse();
<BUG>expectedException.expect(MissingFormatArgumentException.class);
expectedException.expectMessage("Format specifier '%s'");
underTest.execute(request, response);
}</BUG>
@Test

+ "]}");
assertThat(response.stream().status()).isEqualTo(400);
assertThat(response.stream().mediaType()).isEqualTo(MediaTypes.JSON);
}
@Test
public void does_not_fail_to_render_error_message_having_percent() {
ValidatingRequest request = new TestRequest().setMethod("GET").setPath("/api/system/error_message_having_percent");
DumbResponse response = new DumbResponse();
underTest.execute(request, response);
assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"this should not fail %s\"}]}");
assertThat(response.stream().status()).isEqualTo(400);
assertThat(response.stream().mediaType()).isEqualTo(MediaTypes.JSON);
}
@Test
