some refactoring of test