Refactor unittests.