Java Code Examples for

The following are top voted examples for showing how to use These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: vos_backend   File:   View source code 6 votes vote down vote up
public void errorsAsJson() {
    running(fakeApplication(), new Runnable() {
        public void run() {
            Lang lang = new Lang(new play.api.i18n.Lang("en", ""));
            Map<String, List<ValidationError>> errors = new HashMap<String, List<ValidationError>>();
            List<ValidationError> error = new ArrayList<ValidationError>();
            error.add(new ValidationError("foo", RequiredValidator.message, new ArrayList<Object>()));
            errors.put("foo", error);
            DynamicForm form = new DynamicForm(new HashMap<String, String>(), errors, F.None());
            JsonNode jsonErrors = form.errorsAsJson(lang);
            assertThat(jsonErrors.findPath("foo").iterator().next().asText()).isEqualTo(play.i18n.Messages.get(lang, RequiredValidator.message));