@Test public void testToDataModelerErrorFromSyntaxError() { ArrayList<SyntaxError> syntaxErrors = new ArrayList<>(); SyntaxError syntaxError; org.uberfire.java.nio.file.Path path = testRootPath.resolve(JAVA_FILE_FOR_ERRORS_TEST); for(int i = 0; i < 10; i++) { syntaxError = mock(SyntaxError.class); when(syntaxError.getDescription()).thenReturn("message"+i); if (i % 2 == 0) { when(syntaxError.isError()).thenReturn(true); } else { when(syntaxError.isError()).thenReturn(false); } when(syntaxError.getLine()).thenReturn(i); when(syntaxError.getColumn()).thenReturn(i); syntaxErrors.add(syntaxError); } List<DataModelerError> result = serviceHelper.toDataModelerError(syntaxErrors, path); assertEquals(syntaxErrors.size(), result.size()); for (int i = 0; i < syntaxErrors.size(); i++) { assertErrorEquals(syntaxErrors.get(i), result.get(i), Paths.convert(path)); } }
public List<DataModelerError> toDataModelerError(List<DriverError> errors) { final List<DataModelerError> result = new ArrayList<>(); if (errors == null) { return result; } for (DriverError error : errors) { DataModelerError dataModelerError = new DataModelerError( error.getId(), error.getMessage(), Level.ERROR, error.getFile(), error.getLine(), error.getColumn()); result.add(dataModelerError); } return result; }
DataModelerServiceHelper { public List<DataModelerError> toDataModelerError(List<DriverError> errors) { final List<DataModelerError> result = new ArrayList<>(); if (errors == null) { return result; } for (DriverError error : errors) { DataModelerError dataModelerError = new DataModelerError( error.getId(), error.getMessage(), Level.ERROR, error.getFile(), error.getLine(), error.getColumn()); result.add(dataModelerError); } return result; } }
DataModelerServiceHelper { public List<DataModelerError> toDataModelerError(List<DriverError> errors) { final List<DataModelerError> result = new ArrayList<>(); if (errors == null) { return result; } for (DriverError error : errors) { DataModelerError dataModelerError = new DataModelerError( error.getId(), error.getMessage(), Level.ERROR, error.getFile(), error.getLine(), error.getColumn()); result.add(dataModelerError); } return result; } DataModelerServiceHelper(); @Inject  DataModelerServiceHelper(final KieModuleService moduleService,
                                    final @Named("ioStrategy") IOService ioService,
                                    final CommentedOptionFactory commentedOptionFactory); }
DataModelerServiceHelper { public List<DataModelerError> toDataModelerError(List<DriverError> errors) { final List<DataModelerError> result = new ArrayList<>(); if (errors == null) { return result; } for (DriverError error : errors) { DataModelerError dataModelerError = new DataModelerError( error.getId(), error.getMessage(), Level.ERROR, error.getFile(), error.getLine(), error.getColumn()); result.add(dataModelerError); } return result; } 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<DataModelerError> toDataModelerError(List<DriverError> errors) { final List<DataModelerError> result = new ArrayList<>(); if (errors == null) { return result; } for (DriverError error : errors) { DataModelerError dataModelerError = new DataModelerError( error.getId(), error.getMessage(), Level.ERROR, error.getFile(), error.getLine(), error.getColumn()); result.add(dataModelerError); } return result; } 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);  }