Refactor tests to enforce more DRY principle.