### Question:
Single implements Game { @Override public HeroData getHero() { HeroData heroData = player.getHeroData(); if (heroData != null) { return heroData; } return new HeroDataImpl(player.getHero(), multiplayerType.isMultiplayer()); } Single(GamePlayer player, PrinterFactory factory);  Single(GamePlayer player, PrinterFactory factory, MultiplayerType multiplayerType); void on(GameField field); @Override void setProgress(LevelProgress progress); @Override LevelProgress getProgress(); @Override Joystick getJoystick(); @Override boolean isGameOver(); @Override boolean isWin(); @Override boolean shouldLeave(); @Override void newGame(); @Override void loadSave(JSONObject save); @Override Object getBoardAsString(); @Override void close(); @Override void clearScore(); @Override HeroData getHero(); @Override JSONObject getSave(); @Override GamePlayer getPlayer(); @Override GameField getField();  }### Answer:
@Test public void callHeroDataFromPlayer_ifRealizedInPlayer() { when(player.getHeroData()).thenReturn(heroData); HeroData heroData = game.getHero(); assertSame(this.heroData, heroData); }
@Test public void callHeroDataFromHero_ifNotRealizedInPlayer_singleplayer() { when(player.getHeroData()).thenReturn(null); when(hero.getX()).thenReturn(3); when(hero.getY()).thenReturn(5); HeroData heroData = game.getHero(); assertEquals("HeroDataImpl(level=0, coordinate=[3,5], " + "isMultiplayer=false, additionalData=null)", heroData.toString()); }