MockedValues
Mocked values are placeholders used in unit tests to simulate the output of external dependencies or complex objects. They allow a test to focus on the unit under test by providing controllable inputs and expected outputs without requiring the real implementation. This technique is common in test frameworks such as Mockito for Java, unittest.mock for Python, and jest.mock for JavaScript.
When a function calls another component—such as a database, web service, or calculation module—a mocked value
Best practice recommends keeping mocks simple: use stubs for predictably returning values and mocks for verifying
Common pitfalls include not resetting mock state between tests, leading to cross‑test contamination, and mocking too