refactored test for better code sharing