Java, Unit Testing, Legacy Code, Programming, Technology.
= mock(PaymentProcessor.class); OrderService orderService = new OrderService(mockProcessor); Order order = new Order(); orderService.processOrder(order); verify(mockProcessor).process(order); } } Using Test Doubles Test doubles are objects that mimic the behavior of real objects in a controlled