protected void assertConditionsFatalError(RefactoringStatus status, int number) { if (number > 0) { assertTrue("Fatal Error in Condition expected", status.hasFatalError()); // $NON-NLS-1$ } RefactoringStatusEntry[] entries = status.getEntries(); int count = 0; for (RefactoringStatusEntry entry : entries) { if (entry.isFatalError()) { ++count; } } assertEquals(number + " Fatal Errors expected found " + count, number, count); // $NON-NLS-1$ }
protected void assertConditionsWarning(RefactoringStatus conditions, int number) { if (number > 0) { assertTrue("Warning in Condition expected", conditions.hasWarning()); // $NON-NLS-1$ } RefactoringStatusEntry[] entries = conditions.getEntries(); int count = 0; for (RefactoringStatusEntry entry : entries) { if (entry.isWarning()) { ++count; } } assertEquals(number + " Warnings expected found " + count, count, number); // $NON-NLS-1$ }
/** Basically just replaces "renamed" with "created" in all messages. */ private static RefactoringStatus convertRenameToCreateStatus(RefactoringStatus renameStatus) { RefactoringStatus result = new RefactoringStatus(); for (RefactoringStatusEntry entry : renameStatus.getEntries()) { String msg = entry.getMessage(); msg = RenameAnalyzeUtil.convertRenameMessageToCreateMessage(msg); result.addEntry( entry.getSeverity(), msg, entry.getContext(), entry.getPluginId(), entry.getCode()); } return result; }