Refactoring + integration test