CST438 Module 2
In lab 1 on Junit you used a Mock. In your own words describe what a Mock is and why it is useful in unit testing.
A mock is a fake Java class that mimics any external dependencies a program might have such as a database or API. It's useful in unit testing as it can give our test a consistent, predictable, and quick alternative to accessing the final production dependencies it might rely on. For example, testing logic on receiving data from an API when that API's output is constantly changing.
Comments
Post a Comment