use of com.faforever.server.entity.User in project faf-java-server by FAForever.
the class SocialServiceTest method onAuthenticationSuccess.
@Test
public void onAuthenticationSuccess() throws Exception {
User user = (User) new User().setPlayer(new Player().setSocialRelations(Arrays.asList(new SocialRelation(1, null, 10, SocialRelationStatus.FRIEND), new SocialRelation(2, null, 11, SocialRelationStatus.FOE)))).setPassword("pw").setLogin("junit");
FafUserDetails userDetails = new FafUserDetails(user);
instance.onPlayerOnlineEvent(new PlayerOnlineEvent(this, userDetails.getPlayer()));
ArgumentCaptor<SocialRelationListResponse> captor = ArgumentCaptor.forClass(SocialRelationListResponse.class);
verify(clientService).sendSocialRelations(captor.capture(), any());
SocialRelationListResponse response = captor.getValue();
assertThat(response, instanceOf(SocialRelationListResponse.class));
assertThat(response.getSocialRelations(), hasSize(2));
assertThat(response.getSocialRelations().get(0), is(new SocialRelationResponse(10, RelationType.FRIEND)));
assertThat(response.getSocialRelations().get(1), is(new SocialRelationResponse(11, RelationType.FOE)));
}
Aggregations