### Question:
PlayerGame implements Tickable { @Override public boolean equals(Object o) { if (o == null) return false; if (this == NullPlayerGame.INSTANCE && (o != NullPlayer.INSTANCE && o != NullPlayerGame.INSTANCE)) return false; if (o instanceof String) { return o.equals(roomName); } if (o instanceof Player) { Player p = (Player)o; return p.equals(player); } if (o instanceof PlayerGame) { PlayerGame pg = (PlayerGame)o; if (player == null || pg.getPlayer() == null) { return LockedGame.equals(pg.game, game); } return player.equals(pg.player); } if (o instanceof GameField) { GameField gf = (GameField)o; return game.getField() == gf; } return false; } PlayerGame(Player player, Game game, String roomName); static PlayerGame by(Game game); @Override boolean equals(Object o); @Override int hashCode(); void remove(Consumer<PlayerGame> onRemove); GameField getField(); @Override String toString(); @Override void tick(); GameType getGameType(); void setRoomName(String roomName); Player getPlayer(); String popLastCommand(); void clearScore();  }### Answer:
@Test public void testEquals_null() { assertEquals(false, playerGame.equals(null)); }
@Test public void testEquals_withOtherObject() { assertEquals(false, playerGame.equals(new Object())); }
@Test public void testEquals_nullInstance() { assertEquals(false, playerGame.equals(NullPlayerGame.INSTANCE)); assertEquals(true, NullPlayerGame.INSTANCE.equals(NullPlayerGame.INSTANCE)); assertEquals(true, NullPlayerGame.INSTANCE.equals(NullPlayer.INSTANCE)); }
@Test public void testEquals_withPlayer() { Player otherPlayer = new Player("other player", "other url", PlayerTest.mockGameType("game"), NullPlayerScores.INSTANCE, NullInformation.INSTANCE); assertEquals(false, playerGame.equals(otherPlayer)); assertEquals(true, playerGame.equals(player)); }
@Test public void testEquals_playerGameWithPlayer() { GameType gameType = PlayerTest.mockGameType("game"); Player otherPlayer = new Player("other player", "other url", gameType, NullPlayerScores.INSTANCE, NullInformation.INSTANCE); PlayerGame player = new PlayerGame(otherPlayer, NullGame.INSTANCE, gameType.name()); assertEquals(false, playerGame.equals(player)); assertEquals(true, playerGame.equals(playerGame)); }
@Test public void testEquals_roomName() { assertEquals(true, playerGame.equals("room")); assertEquals(false, playerGame.equals("otherRoom")); }
@Test public void testEquals_playerGameWithGame() { Game game = new LockedGame(new ReentrantReadWriteLock()).wrap(mock(Game.class)); PlayerGame player = new PlayerGame(null, game, null); assertEquals(false, playerGame.equals(player)); assertEquals(false, player.equals(playerGame)); }
@Test public void testEquals_player() { PlayerGame player = new PlayerGame(null, game, null); PlayerGame player2 = new PlayerGame(null, mock(Game.class), null); assertEquals(true, playerGame.equals(player)); assertEquals(true, player.equals(playerGame)); assertEquals(false, playerGame.equals(player2)); assertEquals(false, player2.equals(playerGame)); }