Creating an integration test
We have created unit tests in the previous chapter and there are unit tests for the functionalities implemented in the classes of this chapter as well. We will just not print these unit tests here. Instead of listing the unit tests, we will look at an integration test.
Integration tests need the invocation of many classes working together. They check that the functionality can be delivered by the whole application, or at least a larger part of the application, and do not focus on a single unit. They are called integration tests because they test the integration between classes. The classes alone are all OK. They should not have any problem as it was already verified by the unit tests. Integration focuses on how they work together.
If we want to test the Game
class, we will either have to create mocks that mimic the behavior of the other Game
classes, or we will just write an integration test. Technically, an integration test is very similar to a unit test. Many...