Search in sources :

Example 1 with SocialRelationListResponse

use of com.faforever.server.social.SocialRelationListResponse in project faf-java-server by FAForever.

the class SocialRelationResponseListResponseTransformerTest method transform.

@Test
public void transform() throws Exception {
    Map<String, Serializable> result = SocialRelationListResponseTransformer.INSTANCE.transform(new SocialRelationListResponse(Arrays.asList(new SocialRelationResponse(1, RelationType.FRIEND), new SocialRelationResponse(2, RelationType.FOE), new SocialRelationResponse(3, RelationType.FOE), new SocialRelationResponse(4, RelationType.FRIEND))));
    assertThat(result, is(ImmutableMap.of("command", "social", "friends", Arrays.asList(1, 4), "foes", Arrays.asList(2, 3))));
}
Also used : Serializable(java.io.Serializable) SocialRelationListResponse(com.faforever.server.social.SocialRelationListResponse) SocialRelationResponse(com.faforever.server.social.SocialRelationListResponse.SocialRelationResponse) Test(org.junit.Test)

Example 2 with SocialRelationListResponse

use of com.faforever.server.social.SocialRelationListResponse in project faf-java-server by FAForever.

the class V2ServerMessageTransformerTest method socialRelationList.

@Test
public void socialRelationList() throws Exception {
    String response = instance.transform(new SocialRelationListResponse(Arrays.asList(new SocialRelationResponse(1, RelationType.FRIEND), new SocialRelationResponse(2, RelationType.FOE))));
    assertThat(response, is("{\"data\":{\"socialRelations\":[{\"playerId\":1,\"type\":\"FRIEND\"},{\"playerId\":2,\"type\":\"FOE\"}]},\"type\":\"socialRelations\"}"));
}
Also used : SocialRelationListResponse(com.faforever.server.social.SocialRelationListResponse) SocialRelationResponse(com.faforever.server.social.SocialRelationListResponse.SocialRelationResponse) Test(org.junit.Test)

Example 3 with SocialRelationListResponse

use of com.faforever.server.social.SocialRelationListResponse in project faf-java-server by FAForever.

the class ClientServiceTest method sendSocialRelations.

@Test
public void sendSocialRelations() throws Exception {
    SocialRelationListResponse response = new SocialRelationListResponse(emptyList());
    instance.sendSocialRelations(response, clientConnection);
    verify(clientGateway).send(response, clientConnection);
}
Also used : SocialRelationListResponse(com.faforever.server.social.SocialRelationListResponse) Test(org.junit.Test)

Aggregations

SocialRelationListResponse (com.faforever.server.social.SocialRelationListResponse)3 Test (org.junit.Test)3 SocialRelationResponse (com.faforever.server.social.SocialRelationListResponse.SocialRelationResponse)2 Serializable (java.io.Serializable)1