@Test public void testToValidationMessageFromDataModelerError() { ArrayList<DataModelerError> dataModelerErrors = new ArrayList<>(); DataModelerError dataModelerError; Level level; for(int i = 0; i < 10; i++) { level = Level.values()[i % 3]; dataModelerError = new DataModelerError(i, "message"+i,level, mock(Path.class), i, i); dataModelerErrors.add(dataModelerError); } List<ValidationMessage> result = serviceHelper.toValidationMessage(dataModelerErrors); assertEquals(dataModelerErrors.size(), result.size()); for (int i = 0; i < dataModelerErrors.size(); i++) { assertErrorEquals(dataModelerErrors.get(i), result.get(i)); } }
public List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors) { final List<ValidationMessage> validationMessages = new ArrayList<>(); ValidationMessage validationMessage; if (errors == null) { return validationMessages; } for (DataModelerError error : errors) { validationMessage = new ValidationMessage(); validationMessage.setPath(error.getFile()); validationMessage.setText(error.getMessage()); validationMessage.setColumn(error.getColumn()); validationMessage.setLine(error.getLine()); validationMessage.setId(error.getId()); if (error.getLevel() != null) { validationMessage.setLevel(error.getLevel()); } validationMessages.add(validationMessage); } return validationMessages; }
DataModelerServiceHelper { public List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors) { final List<ValidationMessage> validationMessages = new ArrayList<>(); ValidationMessage validationMessage; if (errors == null) { return validationMessages; } for (DataModelerError error : errors) { validationMessage = new ValidationMessage(); validationMessage.setPath(error.getFile()); validationMessage.setText(error.getMessage()); validationMessage.setColumn(error.getColumn()); validationMessage.setLine(error.getLine()); validationMessage.setId(error.getId()); if (error.getLevel() != null) { validationMessage.setLevel(error.getLevel()); } validationMessages.add(validationMessage); } return validationMessages; } }
DataModelerServiceHelper { public List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors) { final List<ValidationMessage> validationMessages = new ArrayList<>(); ValidationMessage validationMessage; if (errors == null) { return validationMessages; } for (DataModelerError error : errors) { validationMessage = new ValidationMessage(); validationMessage.setPath(error.getFile()); validationMessage.setText(error.getMessage()); validationMessage.setColumn(error.getColumn()); validationMessage.setLine(error.getLine()); validationMessage.setId(error.getId()); if (error.getLevel() != null) { validationMessage.setLevel(error.getLevel()); } validationMessages.add(validationMessage); } return validationMessages; } DataModelerServiceHelper(); @Inject  DataModelerServiceHelper(final KieModuleService moduleService,
                                    final @Named("ioStrategy") IOService ioService,
                                    final CommentedOptionFactory commentedOptionFactory); }
DataModelerServiceHelper { public List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors) { final List<ValidationMessage> validationMessages = new ArrayList<>(); ValidationMessage validationMessage; if (errors == null) { return validationMessages; } for (DataModelerError error : errors) { validationMessage = new ValidationMessage(); validationMessage.setPath(error.getFile()); validationMessage.setText(error.getMessage()); validationMessage.setColumn(error.getColumn()); validationMessage.setLine(error.getLine()); validationMessage.setId(error.getId()); if (error.getLevel() != null) { validationMessage.setLevel(error.getLevel()); } validationMessages.add(validationMessage); } return validationMessages; } DataModelerServiceHelper(); @Inject  DataModelerServiceHelper(final KieModuleService moduleService,
                                    final @Named("ioStrategy") IOService ioService,
                                    final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
                                                     final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
                                          final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
                                     final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
                                  final Path javaPath); }
DataModelerServiceHelper { public List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors) { final List<ValidationMessage> validationMessages = new ArrayList<>(); ValidationMessage validationMessage; if (errors == null) { return validationMessages; } for (DataModelerError error : errors) { validationMessage = new ValidationMessage(); validationMessage.setPath(error.getFile()); validationMessage.setText(error.getMessage()); validationMessage.setColumn(error.getColumn()); validationMessage.setLine(error.getLine()); validationMessage.setId(error.getId()); if (error.getLevel() != null) { validationMessage.setLevel(error.getLevel()); } validationMessages.add(validationMessage); } return validationMessages; } DataModelerServiceHelper(); @Inject  DataModelerServiceHelper(final KieModuleService moduleService,
                                    final @Named("ioStrategy") IOService ioService,
                                    final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
                                                     final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
                                          final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
                                     final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
                                  final Path javaPath);  }