Refactoring to the credential test cases.