Search in sources :

Example 1 with ReplayData

use of com.faforever.commons.replay.ReplayData in project downlords-faf-client by FAForever.

the class ReplayServiceImplTest method testEnrich.

@Test
public void testEnrich() throws Exception {
    Path path = Paths.get("foo.bar");
    when(replayFileReader.parseReplay(path)).thenReturn(new ReplayData(emptyList(), emptyList()));
    instance.enrich(new Replay(), path);
    verify(replayFileReader).parseReplay(path);
}
Also used : Path(java.nio.file.Path) ReplayData(com.faforever.commons.replay.ReplayData) Test(org.junit.Test)

Example 2 with ReplayData

use of com.faforever.commons.replay.ReplayData in project downlords-faf-client by FAForever.

the class ReplayServiceImpl method enrich.

@Override
public void enrich(Replay replay, Path path) {
    ReplayData replayData = replayFileReader.parseReplay(path);
    replay.getChatMessages().setAll(replayData.getChatMessages().stream().map(chatMessage -> new ChatMessage(chatMessage.getTime(), chatMessage.getSender(), chatMessage.getMessage())).collect(Collectors.toList()));
    replay.getGameOptions().setAll(replayData.getGameOptions().stream().map(gameOption -> new GameOption(gameOption.getKey(), gameOption.getValue())).collect(Collectors.toList()));
}
Also used : ChatMessage(com.faforever.client.replay.Replay.ChatMessage) GameOption(com.faforever.client.replay.Replay.GameOption) ReplayData(com.faforever.commons.replay.ReplayData)

Aggregations

ReplayData (com.faforever.commons.replay.ReplayData)2 ChatMessage (com.faforever.client.replay.Replay.ChatMessage)1 GameOption (com.faforever.client.replay.Replay.GameOption)1 Path (java.nio.file.Path)1 Test (org.junit.Test)1