Robert had the idea to use a fake attribute inside BaseTokenStreamTestCase that records if its clear() method was called. If this is not the case after incrementToken(), asserTokenStreamContents fails. It also uses the attribute in TeeSinkTokenFilter, because there a lot of copying, captureState and restoreState() is used. By the attribute, you can track wonderful, if save/restore and clearAttributes is correctly implemented. It also verifies that before a captureState() it was also cleared (as the state will also contain the clear call). Because if you consume tokens in a filter, capture the consumed tokens and insert them, the capturedStates must also be cleared before.
In contrib analyzers are some test that fail to pass this additional assertion. They are not fixed in the attached patch.
|Component/s||contrib/analyzers [ 12312333 ]|
|Workflow||Default workflow, editable Closed status [ 12563475 ]||jira [ 12585072 ]|
|Workflow||jira [ 12488275 ]||Default workflow, editable Closed status [ 12563475 ]|
|Status||Resolved [ 5 ]||Closed [ 6 ]|
|Status||Open [ 1 ]||Resolved [ 5 ]|
|Resolution||Fixed [ 1 ]|
|Assignee||Uwe Schindler [ thetaphi ]|
|Summary||Advances BaseTokenStreamTestCase that uses a fake attribute to check, if clearAttributes() was called correctly - found bugs in contrib/analyzers||Improve BaseTokenStreamTestCase to uses a fake attribute to check if clearAttributes() was called correctly - found bugs in contrib/analyzers|
|Fix Version/s||2.9.2 [ 12314342 ]|
|Fix Version/s||3.0.1 [ 12314401 ]|
|Affects Version/s||2.9.1 [ 12314295 ]|
|Affects Version/s||2.9 [ 12312682 ]|