running(fakeApplication(), new Runnable() {
public void run() {
Content html = views.html.index.render(loginForm);
assertThat(contentType(html)).isEqualTo("text/html");
assertThat(contentAsString(html)).contains("log in");
}
});
We use this code to test that a view is rendered properly, but the problem is that the text in the view doesn’t use the Messages.en-file we have specified for our actual application (so it renderes login.login instead of “log in” for instance).
Is there a way to configure the fakeapplication to use a specific langauge (and then have it look for the appropriate messages-file)?
We tried this to no avail:
Map<String, String> config = new HashMap<String, String>();
config.put("application.langs", "en");
FakeApplication fakeApp = new FakeApplication(additionalConfiguration = config);
Try this: