String messageKey = "does.not.exist";
validator.setMessageKey(messageKey);
ValidatorContext validatorContext = new DelegatingValidatorContext(new SimpleAction());
validator.setValidatorContext(validatorContext);
validator.validate(this);
assertTrue(validatorContext.hasActionErrors());
Collection<String> errors = validatorContext.getActionErrors();
assertEquals(1, errors.size());
assertEquals(messageKey, errors.toArray()[0]);