restore junit3 tests (IDEA-75876)

This commit is contained in:
anna
2011-10-24 16:27:55 +02:00
parent 976b349461
commit f9e48eebc1
2 changed files with 48 additions and 42 deletions
@@ -15,9 +15,6 @@
*/
package com.intellij.rt.execution.junit.segments;
import org.junit.runner.Description;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
@@ -42,19 +39,19 @@ public abstract class OutputObjectRegistry {
}
private boolean containsKey(Object test) {
return myKnownKeys.containsKey(new ObjectWrapper(test));
return myKnownKeys.containsKey(createObjectWrapper(test));
}
private String getKey(Object test) {
return (String)myKnownKeys.get(new ObjectWrapper(test));
return (String)myKnownKeys.get(createObjectWrapper(test));
}
private void putKey(Object test, String key) {
myKnownKeys.put(new ObjectWrapper(test), key);
myKnownKeys.put(createObjectWrapper(test), key);
}
public void forget(Object test) {
myKnownKeys.remove(new ObjectWrapper(test));
myKnownKeys.remove(createObjectWrapper(test));
}
private String sendObject(Object test, Collection packets) {
@@ -120,40 +117,7 @@ public abstract class OutputObjectRegistry {
return 0;
}
private static class ObjectWrapper {
private Object myObject;
private ObjectWrapper(Object object) {
myObject = object;
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ObjectWrapper that = (ObjectWrapper)o;
if (!myObject.equals(that.myObject)) return false;
if (myObject instanceof Description && that.myObject instanceof Description) {
final ArrayList children = ((Description)myObject).getChildren();
final ArrayList thatChildren = ((Description)that.myObject).getChildren();
if (children.size() != thatChildren.size()) return false;
for (int i = 0, childrenSize = children.size(); i < childrenSize; i++) {
if (!children.get(i).equals(thatChildren.get(i))) return false;
}
}
return true;
}
public int hashCode() {
int hash = myObject.hashCode();
if (myObject instanceof Description) {
final ArrayList children = ((Description)myObject).getChildren();
for (int i = 0, childrenSize = children.size(); i < childrenSize; i++) {
hash = 31 * hash + children.get(i).hashCode();
}
}
return hash;
}
protected Object createObjectWrapper(Object object) {
return object;
}
}