[Minor] refactored tests for persistence layers to remove duplicate code