use of com.faforever.server.entity.Player 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)));
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class ArmyStatisticsServiceTest method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() {
instance = new ArmyStatisticsService(achievementService, eventService, clientService, modService);
player = new Player();
player.setLogin("TestUser");
player.setId(42);
game = new Game();
game.setId(1);
unitStats = new ArmyStatistics.CategoryStats().setAir(new ArmyStatistics.UnitStats()).setLand(new ArmyStatistics.UnitStats()).setNaval(new ArmyStatistics.UnitStats()).setExperimental(new ArmyStatistics.UnitStats()).setCdr(new ArmyStatistics.UnitStats()).setTech1(new ArmyStatistics.UnitStats()).setTech2(new ArmyStatistics.UnitStats()).setTech3(new ArmyStatistics.UnitStats()).setEngineer(new ArmyStatistics.UnitStats()).setTransportation(new ArmyStatistics.UnitStats()).setSacu(new ArmyStatistics.UnitStats());
achievementUpdates = new ArrayList<>();
eventUpdates = new ArrayList<>();
doAnswer(invocation -> {
achievementUpdates.addAll((Collection<? extends AchievementUpdate>) invocation.getArguments()[0]);
return CompletableFuture.completedFuture(null);
}).when(achievementService).executeBatchUpdate(any());
doAnswer(invocation -> {
eventUpdates.addAll((Collection<? extends EventUpdate>) invocation.getArguments()[0]);
return CompletableFuture.completedFuture(null);
}).when(eventService).executeBatchUpdate(any());
}
use of com.faforever.server.entity.Player in project faf-java-server by FAForever.
the class LegacyServicesActivatorsTest method loginRequestCallsUniqueIdService.
@Test
public void loginRequestCallsUniqueIdService() throws Exception {
createAuthentication(new Player());
instance.loginRequest(new LegacyLoginRequest("JUnit", "password", "uniqueId"), clientConnection);
verify(uniqueIdService).verify(any(), eq("uniqueId"));
}
Aggregations