My java code generates Python file from XML input. In order to validate this translation, I would like to go through Python output file and check its content. Right now I am just using String contains method but I think if I could parse Python code into Java POJO, that would make this testing easy. If you think, there is another way to perform this unit testing. Kindly suggest. Thanks in advance.
You can parse python code using antlr library. Via antlr you can build AST (Abstract Syntax Trees) and validate it