@Test @SuppressWarnings("unchecked") public void testDiagramValidationMessage() { final ConstraintViolation<?> rootViolation = mock(ConstraintViolation.class); final Path propertyPath = mock(Path.class); when(propertyPath.toString()).thenReturn("path1"); when(rootViolation.getPropertyPath()).thenReturn(propertyPath); when(rootViolation.getMessage()).thenReturn("message1"); final ModelBeanViolation beanViolation = ModelBeanViolationImpl.Builder.build(rootViolation, "uuid"); final RuleViolation ruleViolation = mock(RuleViolation.class); final DiagramElementViolation<RuleViolation> diagramViolation = mock(DiagramElementViolation.class); final DomainViolation domainViolation = mock(DomainViolation.class); when(diagramViolation.getUUID()).thenReturn("uuid1"); when(diagramViolation.getModelViolations()).thenReturn(Collections.singletonList(beanViolation)); when(diagramViolation.getGraphViolations()).thenReturn(Collections.singletonList(ruleViolation)); when(diagramViolation.getDomainViolations()).thenReturn(Collections.singletonList(domainViolation)); when(ruleViolation.getViolationType()).thenReturn(Violation.Type.WARNING); when(translationService.getViolationMessage(eq(ruleViolation))).thenReturn("rv1"); when(translationService.getValue(eq("aKey"))).thenReturn("aValue"); when(translationService.getElementName("uuid1")).thenReturn(Optional.of("name")); String message = CoreTranslationMessages.getDiagramValidationsErrorMessage(translationService, Collections.singleton(diagramViolation)).get(); message = new SafeHtmlBuilder().appendEscapedLines(message).toSafeHtml().asString(); assertEquals(VALIDATION_ELEMENT_MESSAGE, message); }
public static Optional<String> getDiagramValidationsErrorMessage(final StunnerTranslationService translationService, final Collection<DiagramElementViolation<RuleViolation>> result) { return getValidationMessages(translationService, result) .filter(StringUtils::nonEmpty); }
CoreTranslationMessages { public static Optional<String> getDiagramValidationsErrorMessage(final StunnerTranslationService translationService, final Collection<DiagramElementViolation<RuleViolation>> result) { return getValidationMessages(translationService, result) .filter(StringUtils::nonEmpty); } }
CoreTranslationMessages { public static Optional<String> getDiagramValidationsErrorMessage(final StunnerTranslationService translationService, final Collection<DiagramElementViolation<RuleViolation>> result) { return getValidationMessages(translationService, result) .filter(StringUtils::nonEmpty); }  }
CoreTranslationMessages { public static Optional<String> getDiagramValidationsErrorMessage(final StunnerTranslationService translationService, final Collection<DiagramElementViolation<RuleViolation>> result) { return getValidationMessages(translationService, result) .filter(StringUtils::nonEmpty); }  static Optional<String> getDiagramValidationsErrorMessage(final StunnerTranslationService translationService,
                                                                     final Collection<DiagramElementViolation<RuleViolation>> result); static String getRuleValidationMessage(final StunnerTranslationService translationService,
                                                  final RuleViolation violation); static String getBeanValidationMessage(final StunnerTranslationService translationService,
                                                  final ModelBeanViolation violation); static String getDomainValidationMessage(final DomainViolation violation); static Optional<String> getElementValidationMessage(final StunnerTranslationService translationService,
                                                               final DiagramElementViolation<RuleViolation> elementViolation); }
CoreTranslationMessages { public static Optional<String> getDiagramValidationsErrorMessage(final StunnerTranslationService translationService, final Collection<DiagramElementViolation<RuleViolation>> result) { return getValidationMessages(translationService, result) .filter(StringUtils::nonEmpty); }  static Optional<String> getDiagramValidationsErrorMessage(final StunnerTranslationService translationService,
                                                                     final Collection<DiagramElementViolation<RuleViolation>> result); static String getRuleValidationMessage(final StunnerTranslationService translationService,
                                                  final RuleViolation violation); static String getBeanValidationMessage(final StunnerTranslationService translationService,
                                                  final ModelBeanViolation violation); static String getDomainValidationMessage(final DomainViolation violation); static Optional<String> getElementValidationMessage(final StunnerTranslationService translationService,
                                                               final DiagramElementViolation<RuleViolation> elementViolation); static final String ERROR; static final String WARNING; static final String INFO; static final String REASON; static final String DELETE; static final String EDIT; static final String PRINT; static final String RESET; static final String INCREASE; static final String DECREASE; static final String FIT; static final String ARE_YOU_SURE; static final String COMMAND_SUCCESS; static final String COMMAND_FAILED; static final String VALIDATION_SUCCESS; static final String VALIDATION_PROPERTY; static final String ELEMENT; static final String VALIDATION_FAILED; static final String MEDIATOR_PREVIEW; static final String DIAGRAM_LOAD_FAIL_UNSUPPORTED_ELEMENTS; static final String DIAGRAM_AUTOMATIC_LAYOUT_PERFORMED; static final String COPY_SELECTION; static final String CUT_SELECTION; static final String PASTE_SELECTION; static final String VISIT_GRAPH; static final String VALIDATE; static final String UNDO; static final String SWITCH_GRID; static final String REDO; static final String SAVE; static final String EXPORT_PNG; static final String EXPORT_PDF; static final String EXPORT_JPG; static final String EXPORT_SVG; static final String EXPORT_BPMN; static final String DELETE_SELECTION; static final String CLEAR_DIAGRAM; static final String CLEAR_SHAPES; static final String CONFIRM_CLEAR_DIAGRAM; static final String PERFORM_AUTOMATIC_LAYOUT; static final String NEW_LINE; static final String DOT; static final String COLON; static final String OPEN_BRA; static final String CLOSE_BRA; static final String OPEN_COMMENT; static final String CLOSE_COMMENT; }