I have two classes, Parser
and Item
. The Parser class parses some structured document and returns Item
-objects if you call something like Parser::GetItem(int some_id)
.
The Item class was written with the "Tell - don't ask" principle in mind. By that I mean it doesn't have getter-methods for several internal variables which were filled by the Parser
on construction.
The question now is: How can I unittest the Parser
class? How to check if the internal Item
variables were correctly parsed?
Do I have to rearrange my classes?
Is it maybe bad design that the parser-interface returns fully constructed Item
objects?