String (Test test) { if (test instanceof TestCase) { String name = ((TestCase)test).getName(); if (name != null) return name; } if (test instanceof Describable) { Description description = ((Describable)test).getDescription(); String name = getMethodName(description); if (name != null) return name; } String toString = test.toString(); int braceIdx = toString.indexOf("("); return braceIdx > 0 ? toString.substring(0, braceIdx) : toString; }