### Question:
ClientTranslationMessages extends CoreTranslationMessages { public String getCanvasValidationsErrorMessage(final String key, final Iterable<CanvasViolation> result) { return getCanvasValidationsErrorMessage(translationService, key, result); } @Inject  ClientTranslationMessages(final StunnerTranslationService translationService); String getCanvasValidationsErrorMessage(final String key,
                                                   final Iterable<CanvasViolation> result); String getCanvasCommandValidationsErrorMessage(final Iterable<CanvasViolation> result); static String getCanvasValidationsErrorMessage(final StunnerTranslationService translationService,
                                                          final String key,
                                                          final Iterable<CanvasViolation> result); static String getCanvasCommandValidationsErrorMessage(final StunnerTranslationService translationService,
                                                                 final Iterable<CanvasViolation> result); String getRuleValidationMessage(final RuleViolation violation); String getBeanValidationMessage(final ModelBeanViolation violation);  }### Answer:
@Test public void testCanvasValidationMessage() { final RuleViolation ruleViolation = mock(RuleViolation.class); final CanvasViolation canvasViolation = mock(CanvasViolation.class); when(canvasViolation.getViolationType()).thenReturn(Violation.Type.ERROR); when(canvasViolation.getRuleViolation()).thenReturn(ruleViolation); when(ruleViolation.getViolationType()).thenReturn(Violation.Type.ERROR); when(ruleViolation.getViolationType()).thenReturn(Violation.Type.ERROR); final Iterable<CanvasViolation> violations = Collections.singletonList(canvasViolation); when(translationService.getValue(eq("aKey"))).thenReturn("aValue"); when(translationService.getViolationMessage(eq(canvasViolation))).thenReturn("cv1"); String message = ClientTranslationMessages.getCanvasValidationsErrorMessage(translationService, "aKey", violations); message = new SafeHtmlBuilder().appendEscapedLines(message).toSafeHtml().asString(); assertEquals("aValue." + CoreTranslationMessagesTest.HTML_NEW_LINE + "R" + COLON + CoreTranslationMessagesTest.HTML_NEW_LINE + OPEN_BRA + "1" + CLOSE_BRA + "cv1" + CoreTranslationMessagesTest.HTML_NEW_LINE, message); }