NetworkUpdateTemplate extends AbstractTemplate implements NetworkUpdateOperations { public URI share(NewShare share) { return restOperations.postForLocation(SHARE_URL, share); } NetworkUpdateTemplate(RestOperations restOperations); List<LinkedInNetworkUpdate> getNetworkUpdates(); List<LinkedInNetworkUpdate> getNetworkUpdates(int start, int count); List<LinkedInNetworkUpdate> getNetworkUpdates(NetworkUpdateParameters parameters); List<Comment> getNetworkUpdateComments(String updateKey); void createNetworkUpdate(String update); CurrentShare getCurrentShare(); URI share(NewShare share); void likeNetworkUpdate(String updateKey); void unlikeNetworkUpdate(String updateKey); void commentOnNetworkUpdate(String updateKey, String comment); List<LinkedInProfile> getNetworkUpdateLikes(String updateKey); String getNetworkUpdatesJson(NetworkUpdateParameters parameters); static final int DEFAULT_START; static final int DEFAULT_COUNT; }
@Test public void share() { mockServer.expect(requestTo("https: .andExpect(method(POST)) .andExpect(content().string("{\"comment\":\"Social Integration Platform coming together nicely ...\",\"visibility\":{\"code\":\"connections-only\"}}")) .andRespond(withSuccess("", MediaType.APPLICATION_JSON)); NewShare share = new NewShare(); share.setComment("Social Integration Platform coming together nicely ..."); share.setVisibility(new NewShareVisibility(NewShareVisibilityCode.CONNECTIONS_ONLY)); linkedIn.networkUpdateOperations().share(share); }