Bug 14702 JUnit plugin displays incorrect Failure Trace when using JUnit decorator
The suite method we're running: public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new TD_DecoratorOne(new TestSuite(TC_SomeTest.class))); suite.addTest(new TD_DecoratorTwo(new TestSuite(TC_SomeTest.class))); return suite; } // One of the methods in TC_SomeTest protected void testQuery() { ... some assertEquals()... with a customized message reflecting the decorator that was run. } Assume testQuery() fails when run in each decorator (our decorators are subclasses of TestSetup). System.out.println() reflects the customized message. The JUnit SwingUI reflects the customized message. The JUnit TextUI reflects the customized message. The Eclipse JUnit plugin Failure Trace shows the message for the most recent failure for BOTH failures rather than the correct customized message for each failure. We think the potential source of the problem is that the 2 tests have the same name and it looks like TestRunInfo is basing the failure trace display on the test name (see the equals() method). This may not be the source of the problem...just a guess after looking at the plugin for about 10 minutes. Due to this problem, we really can't depend on the JUnit plugin whenever we use decorators, because the failure message isn't accurate. Other than this issue, we're quite fond of the JUnit plugin and would love to use it.
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/FailureRunView.java
if (index == -1)
			return null;
		return fTable.getItem(index).getText();
	}
	
	private String getClassName() {
		return cutFromTo(getSelectedText(), '(', ')');
	}
	
	private String getMethodName() {
		return cutTo(getSelectedText(), '(');
	}
	
	private static String cutFromTo(String string, char from, char to){
		String modified= string;
		modified= modified.substring(modified.indexOf(from) + 1);
		return cutTo(modified, to);
	}
	
	private static String cutTo(String string, char to){
		int toIndex= string.indexOf(to);
		if (toIndex == -1)
			return string;
		else	
			return string.substring(0, toIndex);
	}
	public void menuAboutToShow(IMenuManager manager){
		if (fTable.getSelectionCount() > 0) {
			String className= getClassName();
			String methodName= getMethodName();