### Question:
BattleManager { public static BattleManager getInstance() { return instance; } protected  BattleManager(); static BattleManager getInstance(); void init(); void destroy(); Battle battleBegin(BattleRoom battleRoom); void battleEnd(Battle battle); void battleOver(Battle battle, BattleStatus status); void battleOverWithRoundOver(Battle battle, BattleStatus status); void stageReady(SessionKey userSessionKey); void stageReady(SessionKey userSessionKey, BceBattleStageReady stageReady); void roleMove(SessionKey userSessionKey, BceRoleMove move); void roleAttack(SessionKey userSessionKey, BceRoleAttack attack); void rolePower(SessionKey userSessionKey, BceRolePower power); void roleUseTool(SessionKey userSessionKey, BceRoleUseTool tool); void roundOver(SessionKey userSessionKey, BceAskRoundOver askRoundOver); void getBattleReward(final User user, final int slotSize); void pickReward(User user, int[] slotIndex); void leaveBattle(SessionKey userSessionKey); void pickTreasureBox(SessionKey userSessionKey, BceBattlePickBox pickBox); void sendChatToAllUsers(SessionKey userSessionKey, String message); void sendVoiceChatToAllUsers(SessionKey userSessionKey, byte[] message, boolean autoplay, int seconds); void changeDirection(SessionKey userSessionKey, BceRoleChangeDirection roleDir); void roleDead(SessionKey userSessionKey, BceDead bceDead); void bulletTrack(SessionKey userSessionKey, BulletTrack[] bulletTracks, 
			int roundNumber, BceBulletTrack bceBulletTrack); void clearAllBattles(); Collection<Battle> findAllBattles(); String findBattleGameServerId(SessionKey userSessionKey); Battle findBattleByBattleSessionKey(SessionKey battleSessionKey); Battle findBattleByUserSessionKey(SessionKey userSessionKey); SessionKey findBattleSessionKeyByUserSessionKey(SessionKey userSessionKey); boolean isUseDistributed(); void submitExecutor(Runnable runnable); int getRoundBulletTrackSeconds(); void setRoundBulletTrackSeconds(int roundBulletTrackSeconds); static final String BATTLE_HAS_REWARD_KEY; static final String BATTLE_ROOM_TYPE_KEY; }### Answer:
@Test public void testChooseBattleMap() { Battle battle = makeReadyBattle(BattleManager.getInstance()); String left = "1"; String right = "2"; for ( int i=0; i<10; i++ ) { BattleBitSetMap map = battle.chooseBattleMap(left, right); if ( !map.getMapId().equals(left) && !map.getMapId().equals(right) ) { fail("mapid = "+map.getMapId()); } } }
@Test public void testChooseBattleMapNullLeft() { Battle battle = makeReadyBattle(BattleManager.getInstance()); String left = null; String right = "2"; for ( int i=0; i<10; i++ ) { BattleBitSetMap map = battle.chooseBattleMap(left, right); if ( !map.getMapId().equals(right) ) { fail("mapid = "+map.getMapId()); } } }
@Test public void testChooseBattleMapBothNull() { Battle battle = makeReadyBattle(BattleManager.getInstance()); String left = null; String right = null; BattleBitSetMap map = battle.chooseBattleMap(left, right); for ( int i=0; i<10; i++ ) { assertNotNull(map); } }
@Test public void testChooseBattleMapInvalid() { Battle battle = makeReadyBattle(BattleManager.getInstance()); String left = "1923923"; String right = "23423423"; BattleBitSetMap map = battle.chooseBattleMap(left, right); for ( int i=0; i<10; i++ ) { assertNotNull(map); } }