Source:
<code>public void setUp() throws SlickException { Image mockedImage = Mockito.mock(Image.class); Mockito.when(mockedImage.getWidth()).thenReturn(5); Mockito.when(mockedImage.getHeight()).thenReturn(5); mockedResources = Mockito.mock(ResourcesWrapper.class); Mockito.when(mockedResources.getTitleScreenBackground()).thenReturn(mockedImage); state = new StartScreenState(mockedResources); mockedController = Mockito.mock(StartScreenStateController.class); state.setController(mockedController); mockedMouseOverArea = Mockito.mock(MouseOverArea.class); Mockito.when(mockedController.createPlayer1Button(Mockito.any())).thenReturn( mockedMouseOverArea); Mockito.when(mockedController.createPlayer2Button(Mockito.any())).thenReturn( mockedMouseOverArea); Mockito.when(mockedController.createOptionsButton(Mockito.any())).thenReturn( mockedMouseOverArea); Mockito.when(mockedController.createHighscoresButton(Mockito.any())).thenReturn( mockedMouseOverArea); Mockito.when(mockedController.createQuitButton(Mockito.any())).thenReturn( mockedMouseOverArea); mockedFont = Mockito.mock(TrueTypeFont.class); <START> Mockito.when(mockedResources.createFont(new Font("Verdana", Font.BOLD, 36), true)) <END> .thenReturn(mockedFont); state.setResources(mockedResources); mockedInput = Mockito.mock(Input.class); state.setInputForTesting(mockedInput); mockedContainer = Mockito.mock(GameContainer.class); Mockito.when(mockedContainer.getInput()).thenReturn(mockedInput); mockedSBG = Mockito.mock(StateBasedGame.class); }</code><technical_language>new Font("Verdana", Font.BOLD, 36), true) replaced "any(), anyBoolean()" improve readability, need return a mocked font for font will/can created. If want return mocked font this font is created is</technical_language>

Target:
public void setUp() throws SlickException { Image mockedImage = Mockito.mock(Image.class); Mockito.when(mockedImage.getWidth()).thenReturn(5); Mockito.when(mockedImage.getHeight()).thenReturn(5); mockedResources = Mockito.mock(ResourcesWrapper.class); Mockito.when(mockedResources.getTitleScreenBackground()).thenReturn(mockedImage); state = new StartScreenState(mockedResources); mockedController = Mockito.mock(StartScreenStateController.class); state.setController(mockedController); mockedMouseOverArea = Mockito.mock(MouseOverArea.class); Mockito.when(mockedController.createPlayer1Button(Mockito.any())).thenReturn( mockedMouseOverArea); Mockito.when(mockedController.createPlayer2Button(Mockito.any())).thenReturn( mockedMouseOverArea); Mockito.when(mockedController.createOptionsButton(Mockito.any())).thenReturn( mockedMouseOverArea); Mockito.when(mockedController.createHighscoresButton(Mockito.any())).thenReturn( mockedMouseOverArea); Mockito.when(mockedController.createQuitButton(Mockito.any())).thenReturn( mockedMouseOverArea); mockedFont = Mockito.mock(TrueTypeFont.class); Mockito.when(mockedResources.createFont(Mockito.any(), Mockito.anyBoolean())) .thenReturn(mockedFont); state.setResources(mockedResources); mockedInput = Mockito.mock(Input.class); state.setInputForTesting(mockedInput); mockedContainer = Mockito.mock(GameContainer.class); Mockito.when(mockedContainer.getInput()).thenReturn(mockedInput); mockedSBG = Mockito.mock(StateBasedGame.class); }