Gualtiero Testa (17) [Avatar] Offline

in the chapter 3 listings, mocks are injected manually. For example in the listing 3.10:

// test method level
final Games games = new Games();
games.em = entityManager;

Why Mockito @InjectMocks has not been used?

I usually do the following:
// class level
@InjectMocks private Games games;

// test method level
// just use games

Which is less code in the test methods and it works with both field and setter injection.