Ejemplo n.º 1
0
 protected void assertConditionsOk(RefactoringStatus conditions) {
   assertTrue(
       conditions.isOK()
           ? "OK"
           : "Error or Warning in Conditions: "
               + conditions.getEntries()[0].getMessage(), // $NON-NLS-1$ //$NON-NLS-2$
       conditions.isOK());
 }
Ejemplo n.º 2
0
 public void test_toLTK_Throwable() throws Exception {
   Throwable e = new Throwable("msg");
   org.eclipse.ltk.core.refactoring.RefactoringStatus ltkStatus = ServiceUtils.toLTK(e);
   org.eclipse.ltk.core.refactoring.RefactoringStatusEntry[] ltkEntries = ltkStatus.getEntries();
   assertThat(ltkEntries).hasSize(1);
   // entry[0]
   assertEquals("msg", ltkEntries[0].getMessage());
   assertEquals(
       org.eclipse.ltk.core.refactoring.RefactoringStatus.FATAL, ltkEntries[0].getSeverity());
 }
Ejemplo n.º 3
0
 /** 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;
 }
Ejemplo n.º 4
0
 public void test_toLTK_RefactoringStatus() throws Exception {
   RefactoringStatus serviceStatus = RefactoringStatus.createErrorStatus("msg");
   org.eclipse.ltk.core.refactoring.RefactoringStatus ltkStatus =
       ServiceUtils.toLTK(serviceStatus);
   org.eclipse.ltk.core.refactoring.RefactoringStatusEntry[] ltkEntries = ltkStatus.getEntries();
   assertThat(ltkEntries).hasSize(1);
   // entry[0]
   assertEquals("msg", ltkEntries[0].getMessage());
   assertEquals(
       org.eclipse.ltk.core.refactoring.RefactoringStatus.ERROR, ltkEntries[0].getSeverity());
 }
Ejemplo n.º 5
0
 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$
 }
Ejemplo n.º 6
0
 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$
 }
 private static boolean containsStatusEntry(
     final RefactoringStatus status, final RefactoringStatusEntry other) {
   return status.getEntries(
               new IRefactoringStatusEntryComparator() {
                 public final int compare(
                     final RefactoringStatusEntry entry1, final RefactoringStatusEntry entry2) {
                   return entry1.getMessage().compareTo(entry2.getMessage());
                 }
               },
               other)
           .length
       > 0;
 }