diff --git a/faf-commons-data/src/main/java/com/faforever/commons/replay/ReplaySemantics.java b/faf-commons-data/src/main/java/com/faforever/commons/replay/ReplaySemantics.java index 6af2541d..2899ebde 100644 --- a/faf-commons-data/src/main/java/com/faforever/commons/replay/ReplaySemantics.java +++ b/faf-commons-data/src/main/java/com/faforever/commons/replay/ReplaySemantics.java @@ -91,7 +91,7 @@ public static String getMapFolder (ReplayContainer replayContainer) throws Illeg * @param events A list of events * @return A list of events that are chat messages */ - public static List getChatMessages(List sources, List events) { + public static List getChatMessages(List events) { return events.stream().map((registeredEvent) -> switch (registeredEvent.event()) { // TODO: the fact that we piggy-back on the 'GiveResourcesToPlayer' callback to embed chat messages is all wrong! We should instead introduce an alternative callback with the sole purpose to send messages. diff --git a/faf-commons-data/src/test/java/com/faforever/commons/replay/LoadReplayLoaderTest.java b/faf-commons-data/src/test/java/com/faforever/commons/replay/LoadReplayLoaderTest.java index ba95b360..d2ee5e77 100644 --- a/faf-commons-data/src/test/java/com/faforever/commons/replay/LoadReplayLoaderTest.java +++ b/faf-commons-data/src/test/java/com/faforever/commons/replay/LoadReplayLoaderTest.java @@ -45,7 +45,7 @@ public void parseBinary01() throws CompressorException, IOException { assertNoErrorTokens(fafReplayContainer); assertEquals("neroxis_map_generator_1.11.0_wvmzfgnlgiebu_bqgaeb3bgzldwstbaa", ReplaySemantics.getMapFolder(fafReplayContainer)); - List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents()); + List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents()); assertEquals(106, chatMessages.size()); } ); @@ -63,7 +63,7 @@ public void parseBinary02() throws CompressorException, IOException { assertNoErrorTokens(fafReplayContainer); assertEquals("SCMP_039", ReplaySemantics.getMapFolder(fafReplayContainer)); - List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents()); + List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents()); assertEquals(2, chatMessages.size()); } ); @@ -81,7 +81,7 @@ public void parseBinary03() throws CompressorException, IOException { assertNoErrorTokens(fafReplayContainer); assertEquals("dualgap_fix_adaptive.v0007", ReplaySemantics.getMapFolder(fafReplayContainer)); - List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents()); + List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents()); assertEquals(1, chatMessages.size()); } ); @@ -99,7 +99,7 @@ public void parseBinary04() throws CompressorException, IOException { assertNoErrorTokens(fafReplayContainer); assertEquals("SCMP_009", ReplaySemantics.getMapFolder(fafReplayContainer)); - List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents()); + List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents()); assertEquals(7, chatMessages.size()); } ); @@ -117,7 +117,7 @@ public void parseBinary05() throws CompressorException, IOException { assertNoErrorTokens(fafReplayContainer); assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer)); - List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents()); + List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents()); assertEquals(0, chatMessages.size()); } ); @@ -135,7 +135,7 @@ public void parseBinary06() throws CompressorException, IOException { assertNoErrorTokens(fafReplayContainer); assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer)); - List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents()); + List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents()); assertEquals(0, chatMessages.size()); } ); @@ -153,7 +153,7 @@ public void parseBinary07() throws CompressorException, IOException { assertNoErrorTokens(fafReplayContainer); assertEquals("SCMP_026", ReplaySemantics.getMapFolder(fafReplayContainer)); - List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents()); + List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents()); assertEquals(3, chatMessages.size()); } ); @@ -178,7 +178,7 @@ public void parseBinary08() throws CompressorException, IOException { assertNoErrorTokens(fafReplayContainer); assertEquals("project_tumulus.v0004", ReplaySemantics.getMapFolder(fafReplayContainer)); - List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.header().sources(), fafReplayContainer.registeredEvents()); + List chatMessages = ReplaySemantics.getChatMessages(fafReplayContainer.registeredEvents()); assertEquals(0, chatMessages.size()); } );