use of com.faforever.server.entity.Avatar in project faf-java-server by FAForever.
the class ClientServiceTest method sendUserDetails.
@Test
public void sendUserDetails() throws Exception {
Avatar avatar = new Avatar().setUrl("http://example.com").setDescription("Tooltip");
player.setAvailableAvatars(Collections.singletonList(new AvatarAssociation().setAvatar(avatar).setPlayer(player).setSelected(true))).setGlobalRating((GlobalRating) new GlobalRating().setNumGames(12).setMean(1100d).setDeviation(100d)).setLadder1v1Rating((Ladder1v1Rating) new Ladder1v1Rating().setMean(900d).setDeviation(50d)).setClanMemberships(Collections.singletonList(new ClanMembership().setClan(new Clan().setTag("FOO")))).setCountry("CH").setLogin("JUnit").setId(5);
instance.sendLoginDetails(player, player);
ArgumentCaptor<PlayerResponse> captor = ArgumentCaptor.forClass(PlayerResponse.class);
verify(clientGateway).send(captor.capture(), any());
PlayerResponse response = captor.getValue();
assertThat(response.getPlayerId(), is(5));
assertThat(response.getUsername(), is("JUnit"));
assertThat(response.getPlayer().getAvatar().getDescription(), is("Tooltip"));
assertThat(response.getPlayer().getAvatar().getUrl(), is("http://example.com"));
assertThat(response.getPlayer().getGlobalRating().getMean(), is(1100d));
assertThat(response.getPlayer().getGlobalRating().getDeviation(), is(100d));
assertThat(response.getPlayer().getLadder1v1Rating().getMean(), is(900d));
assertThat(response.getPlayer().getLadder1v1Rating().getDeviation(), is(50d));
assertThat(response.getPlayer().getNumberOfGames(), is(12));
assertThat(response.getPlayer().getClanTag(), is("FOO"));
assertThat(response.getCountry(), is("CH"));
}
use of com.faforever.server.entity.Avatar in project faf-java-server by FAForever.
the class ClientServiceTest method sendAvatarList.
@Test
public void sendAvatarList() throws Exception {
List<Avatar> avatars = Arrays.asList(new Avatar().setUrl("http://example.com/foo.bar").setDescription("Foo bar"), new Avatar());
ConnectionAware connectionAware = new Player().setClientConnection(clientConnection);
instance.sendAvatarList(avatars, connectionAware);
ArgumentCaptor<AvatarsResponse> captor = ArgumentCaptor.forClass(AvatarsResponse.class);
verify(clientGateway).send(captor.capture(), eq(clientConnection));
assertThat(captor.getValue().getAvatars(), hasSize(2));
assertThat(captor.getValue().getAvatars().get(0).getUrl(), is("http://example.com/foo.bar"));
assertThat(captor.getValue().getAvatars().get(0).getDescription(), is("Foo bar"));
}
Aggregations