Refactor the TestSuiteParser.java class
dakaa16 opened this issue · 0 comments
dakaa16 commented
Currently the TestSuiteParser has too much responsibility. This results in the class being a cluttered mess.
The class should have the single responsibility: 'Parse testsuites'. It should not directly create mocks or generate code - a level of abstraction should exist for this.
A way to do this would be something akin to:
- A class for holding the testsuite state
- A reader-class that returns tokens and updates the testsuite state
- Keyword actions are triggered by specific states
- Keyword actions could be of type
Consumer<T>
, to minimize duplication of code - Keyword actions should actually be utilized
- A class or maybe multiple classes should generate cobol code
- All of the above is used by
TestSuiteParser.getParsedTestSuiteLines
, that ties everything together with a simple loop and a switch statement, that triggers keyword actions (with an argument), based on the current state
The above list is a step towards having the TestSuiteParser have a single responsibility. Further steps is required. View the list as a way to get started.