@Test
public void inviteByMail() throws Exception {

    server.enqueue(new MockResponse().setBody("{\n"
          + "  \"invitation_stats\": {\n"
          + "    \"total_addresses\": 7,\n"
          + "    \"invitations_sent\": 3,\n"
          + "    \"already_invited\": [\n"
          + "      \"kven.sever@example.net\"\n"
          + "    ],\n"
          + "    \"already_member\": [\n"
          + "      {\n"
          + "        \"id\": \"666666_abcdef\",\n"
          + "        \"email\": \"sark.midt@xing.com\",\n"
          + "        \"display_name\": \"Sark Midt\"\n"
          + "      },\n"
          + "      {\n"
          + "        \"id\": \"12345_abcdef\",\n"
          + "        \"email\": \"kennart.loopmann@xing.com\",\n"
          + "        \"display_name\": \"Kennart Loopmann\"\n"
          + "      }\n"
          + "    ],\n"
          + "    \"invalid_addresses\": [\n"
          + "      \"@example.f\"\n"
          + "    ]\n"
          + "  }\n"
          + '}'));
    Response<InvitationStats, HttpError> response = resource.inviteByMail("test@test.test", "email").execute();
    // If no exception was thrown then the spec is build correctly.
    assertThat(response.body().getTotalAddresses()).isEqualTo(7);
    assertThat(response.body().getInvitationsSent()).isEqualTo(3);
    assertThat(response.body().getAlreadyInvited()).containsExactly("kven.sever@example.net");
    assertThat(response.body().getInvalidAddresses()).containsExactly("@example.f");
    assertThat(response.body().getAlreadyMember().size()).isEqualTo(2);
}