Refactored EMM-unit test code.