In short, Mock objects are a great way to simulate an object that we need to work with. Sometimes we may also come across situations or states that are difficult to reproduce. Say for example we need to simulate a network error, or a specific error in our DB, with a mocking framework we can easily do this. Another great thing about mocking frameworks is whatever external data is being used won't be affected. We can simulate a DB call and not affect our DB at all. You can also write a mock for a piece of code that doesnt exist.