Define a separate module with a set of valid and invalid tests, and a set of junit tests that either
(i) check for parser errors, if invalid tests - although each parser may generate different types of messages, so it may not be possible to do a precise match - so just indicate that an error has been detected should be fine
(ii) when parsed successfully, check the returned model against an expected model. For this we could build a replicate of the expected model and then serialize each model into a list of model nodes, but visiting both models and using the visitor to add the visited node to a list. Then check that the lists match - for each ModelObject, possibly check its properties - where the property is a list, check it has the same number of elements (possibly skipping the properties map).
Define a separate module with a set of valid and invalid tests, and a set of junit tests that either
(i) check for parser errors, if invalid tests - although each parser may generate different types of messages, so it may not be possible to do a precise match - so just indicate that an error has been detected should be fine
(ii) when parsed successfully, check the returned model against an expected model. For this we could build a replicate of the expected model and then serialize each model into a list of model nodes, but visiting both models and using the visitor to add the visited node to a list. Then check that the lists match - for each ModelObject, possibly check its properties - where the property is a list, check it has the same number of elements (possibly skipping the properties map).