refactored test code to hide output messages while testing