package com.intellij.rt.execution.junit2;

import junit.framework.TestResult;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.framework.Test;

import java.util.Hashtable;
import java.util.Enumeration;

public class RunOnce extends TestResult {
  private Hashtable myPeformedTests = new Hashtable();
  private static final String NOT_ALLOWED_IN_ID = ":";

  protected void run(TestCase test) {
    if (test.getClass().getName().startsWith(TestSuite.class.getName())) {
      super.run(test);
    } else {
      String testKey = keyOf(test);
      if (!myPeformedTests.containsKey(testKey)) {
        super.run(test);
        myPeformedTests.put(testKey, test);
      } else {
        fireTestSkipped(test, (Test)myPeformedTests.get(testKey));
      }
    }
  }

  private void fireTestSkipped(TestCase test, Test peformedTest) {
    for (Enumeration each = fListeners.elements(); each.hasMoreElements();) {
      Object listener = each.nextElement();
      if (listener instanceof TestSkippingListener)
        ((TestSkippingListener)listener).onTestSkipped(test, peformedTest);
    }
  }

  private String keyOf(TestCase test) {
    return test.getClass().getName() + NOT_ALLOWED_IN_ID +
        test.getName() + NOT_ALLOWED_IN_ID +
        test.toString();
  }
}

@@ -63,22 +63,16 @@
 ork.Test
-Result
 ;%0Aimport
@@ -125,21 +125,22 @@
 ork.Test
-Suite
+Result
 ;%0Aimport
@@ -160,16 +160,21 @@
 ork.Test
+Suite
 ;%0A%0Aimpor
@@ -199,38 +199,8 @@
 ble;
-%0Aimport java.util.Enumeration;
 %0A%0Apu
@@ -836,73 +836,45 @@
 or (
-Enumeration each = fListeners.elements(); each.hasMoreElements();
+int i = 0; i %3C fListeners.size(); i++
 ) %7B%0A
@@ -901,25 +901,24 @@
 r = 
-each.nextElemen
+fListeners.ge
 t(
+i
 );%0A 
@@ -967,16 +967,18 @@
 istener)
+ %7B
 %0A       
@@ -1042,24 +1042,32 @@
 ormedTest);%0A
+      %7D%0A
     %7D%0A  %7D%0A%0A 
@@ -1168,24 +1168,27 @@
 D +%0A        
+   
 test.getName
@@ -1204,32 +1204,35 @@
 ALLOWED_IN_ID +%0A
+   
         test.toS

Upgrade to JUnit 4.0: Fixing Vector -> List update consequences.