ConnectionTemplate extends AbstractTemplate implements ConnectionOperations { public List<XingProfile> getConnections() { XingConnections connections = restOperations.getForObject(buildUrl(CONNECTIONS_URL), XingConnections.class,"me"); return connections.getContacts().getUsers(); } ConnectionTemplate(String xingBaseUrl, RestOperations restOperations);  ConnectionTemplate(RestOperations restOperations); List<XingProfile> getConnections(); List<XingProfile> getConnections(String id); @Override List<XingProfile> getConnectionWithProfil(); List<XingProfile> getConnections(int start, int count);  }
@Test public void getConections() { mockServer.expect(requestTo(XingTemplate.DEFAULT_BASE_URL + ConnectionTemplate.CONNECTIONS_URL.replaceFirst("\\{id\\}", "me"))).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("testdata/connections.json", getClass()), MediaType.APPLICATION_JSON)); List<XingProfile> profiles = xing.connectionOperations().getConnections(); assertThat(profiles, hasSize(10)); for (XingProfile profile : profiles) { assertThat(profile.getId().length(), is(greaterThan(1))); } }
@Test public void getConectionsWithProfil() { mockServer.expect(requestTo(XingTemplate.DEFAULT_BASE_URL + ConnectionTemplate.CONNECTIONS_URL.replaceFirst("\\{id\\}", "me"))).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("testdata/connections_with_fields.json", getClass()), MediaType.APPLICATION_JSON)); List<XingProfile> profiles = xing.connectionOperations().getConnections(); assertThat(profiles, hasSize(5)); for (XingProfile profile : profiles) { assertThat(profile.getId().length(), is(greaterThan(1))); assertThat(profile.getDisplayName().length(), is(greaterThan(1))); } }