refactoring testcode