refactoring: extracted setupWithMockT function for tests