/** * Returns all warnings currently in workspace. * * @param project * @return */ public List<String> getAllWarnings() { List<String> warnings = new ArrayList<String>(); ProblemsView problemsView = new ProblemsView(); problemsView.open(); for (Problem warning : problemsView.getProblems(ProblemType.WARNING)) { warnings.add(warning.getDescription()); } return warnings; }
/** Returns all errors from Problems View as a List of Strings */ public List<String> getAllErrors() { List<String> errors = new ArrayList<String>(); ProblemsView problemsView = new ProblemsView(); problemsView.open(); for (Problem error : problemsView.getProblems(ProblemType.ERROR)) { errors.add(error.getDescription()); } return errors; }
/** Checks for errors in Problems View. Fails if there is some. */ public void checkForErrors() { ProblemsView problemsView = new ProblemsView(); problemsView.open(); List<Problem> errors = problemsView.getProblems(ProblemType.ERROR); if (!errors.isEmpty()) { String failureMessage = "There are errors after importing project"; for (Problem problem : errors) { failureMessage += problem.getDescription(); failureMessage += System.getProperty("line.separator"); } fail(failureMessage); } }
/** Checks whether there are present errors and fails with description of errors if yes. */ public static void checkErrors() { // temporally until problem with Errors sync is present. new ShellMenu("Project", "Clean...").select(); AbstractWait.sleep(TimePeriod.SHORT); new OkButton().click(); AbstractWait.sleep(TimePeriod.SHORT); AbstractWait.sleep(TimePeriod.SHORT); List<Problem> problems = new ProblemsView().getProblems(ProblemType.ERROR); String msg = ""; for (Problem problem : problems) { msg += problem.getPath() + "/" + problem.getResource() + "/" + problem.getLocation() + " | " + problem.getDescription() + "\n"; } assertTrue("Validation Errors:\n" + msg, problems.isEmpty()); }