verify encoding and content type

This commit is contained in:
Sebastian Sdorra
2019-02-01 09:42:19 +01:00
parent 34542e5cf1
commit 0a29f41835
2 changed files with 9 additions and 1 deletions

View File

@@ -194,6 +194,8 @@ public class I18nServletTest {
assertJson(json);
verify(cache).get(path);
verify(cache).put(eq(path), any());
verifyHeaders(response);
}
@Test
@@ -221,6 +223,8 @@ public class I18nServletTest {
verify(cache, never()).put(eq(path), any());
verify(cache).get(path);
assertJson(json);
verifyHeaders(response);
}
@Test
@@ -234,6 +238,11 @@ public class I18nServletTest {
assertJson(jsonNodeOptional.orElse(null));
}
private void verifyHeaders(HttpServletResponse response) {
verify(response).setCharacterEncoding("UTF-8");
verify(response).setContentType("application/json");
}
public void assertJson(JsonNode actual) throws IOException {
assertJson(actual.toString());
}