Class GUIRunner.TestCaseLister
- java.lang.Object
-
- eu.simuline.testhelpers.GUIRunner.TestCaseLister
-
- All Implemented Interfaces:
GUIRunner.Selector
,java.util.EventListener
,javax.swing.event.ListSelectionListener
- Enclosing class:
- GUIRunner
static class GUIRunner.TestCaseLister extends java.lang.Object implements javax.swing.event.ListSelectionListener, GUIRunner.Selector
Represents the list of testcases already failed shown in one of the tabs and astackTraceLister
which represents the stack trace box below the tabbed pane.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.DefaultListModel<TestCase>
failureListMod
The list of testcases which are either ignored, failed in some sense or with hurt assumption.private javax.swing.ListSelectionModel
failureSelection
The current selection offailureListMod
.private GUIRunner.Selector
selector
Selector to be influenced: If this is in the selected tab,selector
is the tab with theGUIRunner.HierarchyWrapper
; otherwise it isGUIRunner.TabChangeListener.EMPTY_SELECTOR
.private GUIRunner.StackTraceLister
stackTraceLister
Contains the stack trace if a failure infailureListMod
is selected which caused an exception.
-
Constructor Summary
Constructors Constructor Description TestCaseLister()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addSelectedTestCaseByNeed(TestCase testCase)
AddstestCase
to the failure list if not yet listed.void
clearSelection()
Clears the selection.(package private) javax.swing.JList<TestCase>
getFailList()
(package private) java.awt.Component
getStackTraceBox()
(package private) void
initClassStructure()
Clears the failure list, its selection and the failure stack.(package private) void
noteReportResult(TestCase testCase)
Notifies that the singular testtestCase
is finished.void
registerSelector(GUIRunner.Selector selector)
Acquaints this selector with another one which is notified of the selection events of thisSelector
.void
setSelection(int index)
Sets selection ofindex
th item and clears other selections.(package private) void
startTestRun()
void
valueChanged(javax.swing.event.ListSelectionEvent lse)
Called whenever the value of the selection changes.
-
-
-
Field Detail
-
failureSelection
private final javax.swing.ListSelectionModel failureSelection
The current selection offailureListMod
. At most one entry is selected. If so, the according element inGUIRunner.HierarchyWrapper.treeSelection
is selected also.- See Also:
valueChanged(ListSelectionEvent)
-
failureListMod
private final javax.swing.DefaultListModel<TestCase> failureListMod
The list of testcases which are either ignored, failed in some sense or with hurt assumption.
-
stackTraceLister
private final GUIRunner.StackTraceLister stackTraceLister
Contains the stack trace if a failure infailureListMod
is selected which caused an exception. This is true if an assertion was wrong, an assumption was wron or if the execution of a testcase could not be completed due to an exception.
-
selector
private GUIRunner.Selector selector
Selector to be influenced: If this is in the selected tab,selector
is the tab with theGUIRunner.HierarchyWrapper
; otherwise it isGUIRunner.TabChangeListener.EMPTY_SELECTOR
. Set byregisterSelector(GUIRunner.Selector)
.
-
-
Method Detail
-
getFailList
javax.swing.JList<TestCase> getFailList()
-
getStackTraceBox
java.awt.Component getStackTraceBox()
-
initClassStructure
void initClassStructure()
Clears the failure list, its selection and the failure stack.
-
startTestRun
void startTestRun()
-
noteReportResult
void noteReportResult(TestCase testCase)
Notifies that the singular testtestCase
is finished.If the test failed, it should be in the failure list
failureListMod
. If so the element is added if not yet present.If
testCase
is selected then iftestCase
failed, the stack tracestackTraceLister
is set to the stacktrace of the failure; otherwise the stacktrace is cleared.- Parameters:
testCase
- The testcase comprising the result of the singular test finished.
-
addSelectedTestCaseByNeed
void addSelectedTestCaseByNeed(TestCase testCase)
AddstestCase
to the failure list if not yet listed. It is assumed thattestCase
failed and that it is selected in theGUIRunner.HierarchyWrapper
.- Parameters:
testCase
- a testcase which failed.
-
setSelection
public void setSelection(int index)
Description copied from interface:GUIRunner.Selector
Sets selection ofindex
th item and clears other selections.- Specified by:
setSelection
in interfaceGUIRunner.Selector
- Parameters:
index
- a non-negativeint
value representing the index of a testcase. **** CAUTION: This presupposes that in a tree only the leaves can be selected.
-
clearSelection
public void clearSelection()
Description copied from interface:GUIRunner.Selector
Clears the selection.- Specified by:
clearSelection
in interfaceGUIRunner.Selector
-
registerSelector
public void registerSelector(GUIRunner.Selector selector)
Description copied from interface:GUIRunner.Selector
Acquaints this selector with another one which is notified of the selection events of thisSelector
. The one in the foreground is notified directly by a mouse event, whereas the one in the background is selected via registration. The one in the background in turn notifies the empty selectorGUIRunner.TabChangeListener.EMPTY_SELECTOR
which takes no actions.- Specified by:
registerSelector
in interfaceGUIRunner.Selector
- Parameters:
selector
- anotherSelector
.- See Also:
GUIRunner.TabChangeListener.setSelUnSel(int)
-
valueChanged
public void valueChanged(javax.swing.event.ListSelectionEvent lse)
Called whenever the value of the selection changes.CAUTION: From the documentation of
ListSelectionEvent
: queries fromListSelectionModel
, rather fromListSelectionEvent
.If an entry is selected,
stackTraceLister
is notified of the stacktrace of the throwable of the according testcase andselector
is notified of the selection to trigger the according selection which in turn has further effects invokingGUIRunner.HierarchyWrapper.valueChanged(TreeSelectionEvent)
. Deselection causesstackTraceLister
to clear the stacktrace and also affectsselector
like selection of the root.- Specified by:
valueChanged
in interfacejavax.swing.event.ListSelectionListener
-
-