This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 216334
Collapse All | Expand All

(-)a/junit/src/org/netbeans/modules/junit/output/JUnitTestMethodNode.java (-1 / +23 lines)
Lines 38-43 Link Here
38
 * Contributor(s):
38
 * Contributor(s):
39
 *
39
 *
40
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
40
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
41
 * markiewb@netbeans.org
41
 */
42
 */
42
43
43
package org.netbeans.modules.junit.output;
44
package org.netbeans.modules.junit.output;
Lines 113-123 Link Here
113
114
114
    @Override
115
    @Override
115
    public Action getPreferredAction() {
116
    public Action getPreferredAction() {
116
        return new JumpAction(this, null);
117
        // try to create a jump action to the cause of the test failure
118
        Action actionForStackFrame = createJumpActionForStackFrameOfFailingTestMethod();
119
        if (null != actionForStackFrame) {
120
            return actionForStackFrame;
121
        }
122
123
        return createJumpActionToMethod();
124
    }
125
    
126
    protected Action createJumpActionForStackFrameOfFailingTestMethod() {
127
        if (testcase.getTrouble() != null) {
128
            String[] st = testcase.getTrouble().getStackTrace();
129
            if ((st != null) && (st.length > 0)) {
130
                String stacktraceLine = st[st.length - 1];
131
                return new JumpAction(this, stacktraceLine);
132
            }
133
        }
134
        return null;
117
    }
135
    }
118
136
119
    public JUnitTestcase getTestcase(){
137
    public JUnitTestcase getTestcase(){
120
        return (JUnitTestcase)testcase;
138
        return (JUnitTestcase)testcase;
121
    }
139
    }
122
140
141
    protected Action createJumpActionToMethod() {
142
        return new JumpAction(this, null);
143
    }
144
123
}
145
}
(-)a/junit/src/org/netbeans/modules/junit/output/JumpAction.java (-2 / +9 lines)
Lines 29-34 Link Here
29
 * The Original Software is NetBeans. The Initial Developer of the Original
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
31
 * Microsystems, Inc. All Rights Reserved.
31
 * Microsystems, Inc. All Rights Reserved.
32
 * 
33
 * markiewb@netbeans.org
32
 *
34
 *
33
 * If you wish your version of this file to be governed by only the CDDL
35
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
36
 * or only the GPL Version 2, indicate your decision by adding
Lines 78-85 Link Here
78
            OutputUtils.openTestsuite((TestsuiteNode)node);
80
            OutputUtils.openTestsuite((TestsuiteNode)node);
79
        } else if (node instanceof CallstackFrameNode){
81
        } else if (node instanceof CallstackFrameNode){
80
            OutputUtils.openCallstackFrame(node, callstackFrameInfo);
82
            OutputUtils.openCallstackFrame(node, callstackFrameInfo);
81
        } else if (node instanceof JUnitTestMethodNode){
83
        } else if (node instanceof JUnitTestMethodNode) {
82
            OutputUtils.openTestMethod((JUnitTestMethodNode)node);
84
            if (null != callstackFrameInfo) {
85
                // try to open stackFrame if available
86
                OutputUtils.openCallstackFrame(node, callstackFrameInfo);
87
            } else {
88
                OutputUtils.openTestMethod((JUnitTestMethodNode) node);
89
            }
83
        }
90
        }
84
    }
91
    }
85
92

Return to bug 216334