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 astackTraceListerwhich represents the stack trace box below the tabbed pane.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.DefaultListModel<TestCase>failureListModThe list of testcases which are either ignored, failed in some sense or with hurt assumption.private javax.swing.ListSelectionModelfailureSelectionThe current selection offailureListMod.private GUIRunner.SelectorselectorSelector to be influenced: If this is in the selected tab,selectoris the tab with theGUIRunner.HierarchyWrapper; otherwise it isGUIRunner.TabChangeListener.EMPTY_SELECTOR.private GUIRunner.StackTraceListerstackTraceListerContains the stack trace if a failure infailureListModis 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) voidaddSelectedTestCaseByNeed(TestCase testCase)AddstestCaseto the failure list if not yet listed.voidclearSelection()Clears the selection.(package private) javax.swing.JList<TestCase>getFailList()(package private) java.awt.ComponentgetStackTraceBox()(package private) voidinitClassStructure()Clears the failure list, its selection and the failure stack.(package private) voidnoteReportResult(TestCase testCase)Notifies that the singular testtestCaseis finished.voidregisterSelector(GUIRunner.Selector selector)Acquaints this selector with another one which is notified of the selection events of thisSelector.voidsetSelection(int index)Sets selection ofindexth item and clears other selections.(package private) voidstartTestRun()voidvalueChanged(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.treeSelectionis 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 infailureListModis 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,selectoris 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 testtestCaseis finished.If the test failed, it should be in the failure list
failureListMod. If so the element is added if not yet present.If
testCaseis selected then iftestCasefailed, the stack tracestackTraceListeris 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)
AddstestCaseto the failure list if not yet listed. It is assumed thattestCasefailed 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.SelectorSets selection ofindexth item and clears other selections.- Specified by:
setSelectionin interfaceGUIRunner.Selector- Parameters:
index- a non-negativeintvalue 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.SelectorClears the selection.- Specified by:
clearSelectionin interfaceGUIRunner.Selector
-
registerSelector
public void registerSelector(GUIRunner.Selector selector)
Description copied from interface:GUIRunner.SelectorAcquaints 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_SELECTORwhich takes no actions.- Specified by:
registerSelectorin 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,
stackTraceListeris notified of the stacktrace of the throwable of the according testcase andselectoris notified of the selection to trigger the according selection which in turn has further effects invokingGUIRunner.HierarchyWrapper.valueChanged(TreeSelectionEvent). Deselection causesstackTraceListerto clear the stacktrace and also affectsselectorlike selection of the root.- Specified by:
valueChangedin interfacejavax.swing.event.ListSelectionListener
-
-