Ales, that definitely helps the unit test pass but we would depend on the PersistenceMetaData.getPersistenceUnits() being called before a call to PersistenceUnitMetaData.getPersistenceMetaData() is made.
Your solutin is better than changing the code that doesn't have access to the PersistenceMetaData at the moment. Thanks for the idea. I will see if we can live with this delicate contract.