Refactor Junit test code to remove duplication

No match.