title: Mockito mock annotation multiple objects
body: <p>I'm trying to understand mockito but I'm getting stuck, im trying to mock multiple objects using the @Mock annotation, but it will not mock them. It will only mock the first object (mockBoard).
  If I mock the BoardFactory myself using mock(Boardfactory.class) it will work. But i dont understand why it wont work in the @Mock?</p>
  
  <pre><code>@ExtendWith(MockitoExtension.class)
  class MapParserTest {
  
  //mocks just fine
  @Mock private Board mockBoard;
  
  //wont mock both factories, sets them to null
  @Mock private BoardFactory mockBoardFactory;
  @Mock private LevelFactory mockLevelFactory;
  
  //this will work
  //private BoardFactory mockBoardFactory = mock(BoardFactory.class);
  
  private MapParser mapParser = new MapParser(mockLevelFactory, mockBoardFactory);
  private List&lt;Ghost&gt; ghosts = new ArrayList&lt;&gt;();
  private List&lt;Square&gt; startPositions = new ArrayList&lt;&gt;();
  
  @Test
  void testParseCharMatrix() {
      //Arrange
      char[][] mapMatrix = new char[1][];
      mapMatrix[0] = new char[]{'#'};
  
      //nullPointer exception thrown here
      when(mockBoardFactory.createBoard(any(Square[][].class))).thenReturn(mockBoard);
  
      //Act
      mapParser.parseMap(mapMatrix);
  
      //Assert
      verify(mockLevelFactory).createLevel(mockBoard, ghosts, startPositions);
  }}
  </code></pre>