use of com.faforever.server.game.GameResponse.Player in project faf-java-server by FAForever.
the class V2ServerMessageTransformerTest method game.
@Test
public void game() throws Exception {
Instant startTime = Instant.parse("2007-12-03T10:15:30.00Z");
String response = instance.transform(new GameResponse(1, "Title", GameVisibility.PUBLIC, "password", GameState.ENDED, "faf", Arrays.asList(new SimMod("1-1-1-1", "Mod #1"), new SimMod("2-2-2-2", "Mod #2")), "scmp01", "JUnit4", Arrays.asList(new Player(1, "JUnit4"), new Player(2, "JUnit5")), 12, startTime, 500, 800, Arrays.asList(new FeaturedModFileVersion((short) 1, 4444), new FeaturedModFileVersion((short) 2, 6789))));
assertThat(response, is("{\"data\":{\"id\":1,\"title\":\"Title\",\"gameVisibility\":\"PUBLIC\",\"password\":\"password\",\"state\":\"ENDED\",\"featuredModTechnicalName\":\"faf\",\"simMods\":[{\"uid\":\"1-1-1-1\",\"displayName\":\"Mod #1\"},{\"uid\":\"2-2-2-2\",\"displayName\":\"Mod #2\"}],\"technicalMapName\":\"scmp01\",\"hostUsername\":\"JUnit4\",\"players\":[{\"team\":1,\"name\":\"JUnit4\"},{\"team\":2,\"name\":\"JUnit5\"}],\"maxPlayers\":12,\"startTime\":1196676930000,\"minRating\":500,\"maxRating\":800,\"featuredModFileVersions\":[{\"id\":1,\"version\":4444},{\"id\":2,\"version\":6789}]},\"type\":\"game\"}"));
}
use of com.faforever.server.game.GameResponse.Player in project faf-java-server by FAForever.
the class V2ServerMessageTransformerTest method player.
@Test
public void player() throws Exception {
String response = instance.transform(new PlayerResponse(1, "A", "CH", new PlayerResponse.Player(new Rating(900, 120), new Rating(600, 50), 12, new Avatar("http://localhost/avatar.png", "Avatar"), "AA")));
assertThat(response, is("{\"data\":{\"playerId\":1,\"username\":\"A\",\"country\":\"CH\",\"player\":{\"globalRating\":{\"mean\":900.0,\"deviation\":120.0},\"ladder1v1Rating\":{\"mean\":600.0,\"deviation\":50.0},\"numberOfGames\":12,\"avatar\":{\"url\":\"http://localhost/avatar.png\",\"description\":\"Avatar\"},\"clanTag\":\"AA\"}},\"type\":\"player\"}"));
}
Aggregations