Refactoring on tests