Refactor the piece of code. What is dependency injection, and where would you apply it?
Implement the refactored function process_values(values, policy). The injected policy is a dictionary containing minimum, maximum, factor, and offset; keep values within the inclusive range, then transform each retained value using the injected settings. Return the transformed values in their original order. Explain how injecting the policy improves testability and where dependency injection should be applied.
def process_values(values, policy):