@Test public void validate() { final Collection<DiagramElementViolation<RuleViolation>> violations = validationService.validate(diagram); verify(diagram).getMetadata(); verify(metadata).getDefinitionSetId(); assertEquals(violations.size(), 4); final List<DiagramElementViolation<RuleViolation>> ordered = new ArrayList<>(violations); assertEquals(ordered.get(0).getUUID(), UUID_0); assertEquals(ordered.get(0).getDomainViolations().size(), 1); assertEquals(ordered.get(0).getDomainViolations().iterator().next(), domainViolation); assertEquals(ordered.get(1).getUUID(), UUID_1); assertEquals(ordered.get(1).getDomainViolations().size(), 1); assertEquals(ordered.get(1).getDomainViolations().iterator().next(), domainViolation2); assertEquals(ordered.get(2).getUUID(), UUID_1); assertEquals(ordered.get(2).getDomainViolations().size(), 1); assertEquals(ordered.get(2).getDomainViolations().iterator().next(), domainViolation3); assertEquals(ordered.get(3).getUUID(), UUID_1); assertEquals(ordered.get(3).getDomainViolations().size(), 1); assertEquals(ordered.get(3).getDomainViolations().iterator().next(), domainViolation4); }
@Override public Collection<DiagramElementViolation<RuleViolation>> validate(Diagram diagram) { return domainViolations(diagram).stream() .filter(v -> Objects.nonNull(v.getUUID())) .filter(v -> !"null".equals(v.getUUID())) .map(v -> new ElementViolationImpl.Builder().setUuid(v.getUUID()).setDomainViolations(Collections.singletonList(v)).build()) .collect(Collectors.toList()); }
ProjectValidationServiceImpl implements ProjectValidationService { @Override public Collection<DiagramElementViolation<RuleViolation>> validate(Diagram diagram) { return domainViolations(diagram).stream() .filter(v -> Objects.nonNull(v.getUUID())) .filter(v -> !"null".equals(v.getUUID())) .map(v -> new ElementViolationImpl.Builder().setUuid(v.getUUID()).setDomainViolations(Collections.singletonList(v)).build()) .collect(Collectors.toList()); } }
ProjectValidationServiceImpl implements ProjectValidationService { @Override public Collection<DiagramElementViolation<RuleViolation>> validate(Diagram diagram) { return domainViolations(diagram).stream() .filter(v -> Objects.nonNull(v.getUUID())) .filter(v -> !"null".equals(v.getUUID())) .map(v -> new ElementViolationImpl.Builder().setUuid(v.getUUID()).setDomainViolations(Collections.singletonList(v)).build()) .collect(Collectors.toList()); } protected  ProjectValidationServiceImpl(); @Inject  ProjectValidationServiceImpl(Instance<DomainValidator> validators); }
ProjectValidationServiceImpl implements ProjectValidationService { @Override public Collection<DiagramElementViolation<RuleViolation>> validate(Diagram diagram) { return domainViolations(diagram).stream() .filter(v -> Objects.nonNull(v.getUUID())) .filter(v -> !"null".equals(v.getUUID())) .map(v -> new ElementViolationImpl.Builder().setUuid(v.getUUID()).setDomainViolations(Collections.singletonList(v)).build()) .collect(Collectors.toList()); } protected  ProjectValidationServiceImpl(); @Inject  ProjectValidationServiceImpl(Instance<DomainValidator> validators); @Override Collection<DiagramElementViolation<RuleViolation>> validate(Diagram diagram); }
ProjectValidationServiceImpl implements ProjectValidationService { @Override public Collection<DiagramElementViolation<RuleViolation>> validate(Diagram diagram) { return domainViolations(diagram).stream() .filter(v -> Objects.nonNull(v.getUUID())) .filter(v -> !"null".equals(v.getUUID())) .map(v -> new ElementViolationImpl.Builder().setUuid(v.getUUID()).setDomainViolations(Collections.singletonList(v)).build()) .collect(Collectors.toList()); } protected  ProjectValidationServiceImpl(); @Inject  ProjectValidationServiceImpl(Instance<DomainValidator> validators); @Override Collection<DiagramElementViolation<RuleViolation>> validate(Diagram diagram);  }