Refactored some logic from main test class for easier reuse in other test classes.
Removed warning