NetworkUpdateTemplate extends AbstractTemplate implements NetworkUpdateOperations { public void createNetworkUpdate(String update) { Map<String,String> activity = new HashMap<String, String>(); activity.put("contentType", "linkedin-html"); activity.put("body", update); restOperations.postForLocation(ACTIVITY_URL, activity); } 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 postUpdate() { mockServer.expect(requestTo("https: .andExpect(method(POST)) .andExpect(content().string("{\"body\":\"Cool beans\",\"contentType\":\"linkedin-html\"}")) .andRespond(withSuccess("", MediaType.APPLICATION_JSON)); linkedIn.networkUpdateOperations().createNetworkUpdate("Cool beans"); }