refactored and written test for wfsscannerservice