refactor: extracted UpdateTimer method
This commit is contained in:
parent
4e66a4eb24
commit
6a8de34c67
@ -92,11 +92,11 @@ public class Lobby {
|
|||||||
badRequests = 0;
|
badRequests = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTimer(game.state.getActiveCharacter().type);
|
updateTimer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateTimer(EntityType currentActiveCharacterType) {
|
void updateTimer() {
|
||||||
|
var currentActiveCharacterType = game.state.getActiveCharacter().type;
|
||||||
if (pauseSegment.isPaused()) {
|
if (pauseSegment.isPaused()) {
|
||||||
turnTimer.clear();
|
turnTimer.clear();
|
||||||
} else if (currentActiveCharacterType == EntityType.P1) {
|
} else if (currentActiveCharacterType == EntityType.P1) {
|
||||||
|
@ -35,13 +35,13 @@ class LobbyTest {
|
|||||||
};
|
};
|
||||||
var characterConfig = mock(CharacterConfig.class);
|
var characterConfig = mock(CharacterConfig.class);
|
||||||
|
|
||||||
lobby = new Lobby(
|
lobby = spy(new Lobby(
|
||||||
gameID,
|
gameID,
|
||||||
connection,
|
connection,
|
||||||
partyConfig,
|
partyConfig,
|
||||||
characterConfig,
|
characterConfig,
|
||||||
scenarioConfig
|
scenarioConfig
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -51,9 +51,10 @@ class LobbyTest {
|
|||||||
new RequestBuilder(RequestType.MoveRequest).buildGameRequest()
|
new RequestBuilder(RequestType.MoveRequest).buildGameRequest()
|
||||||
};
|
};
|
||||||
var playerConnection = mock(WebSocket.class);
|
var playerConnection = mock(WebSocket.class);
|
||||||
|
doNothing().when(lobby).updateTimer();
|
||||||
|
|
||||||
Participant playerOne = new Participant(playerConnection, ParticipantType.PlayerOne, "P1");
|
Participant playerOne = new Participant(playerConnection, ParticipantType.PlayerOne, "P1");
|
||||||
lobby.receiveRequests(requests, playerOne);
|
lobby.receiveRequests(requests, playerOne);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user