@Test public void createStatuses() throws Exception { mockServer.expect(requestTo("https: .andExpect(method(HttpMethod.POST)) .andRespond(withSuccess(jsonResource("status"), APPLICATION_JSON)); StatusRequest request = StatusRequest.pendingStatusRequest(); request.setTargetUrl("https: request.setDescription("Build started"); request.setContext("continuous-integration/whatever"); Status status = statusesTemplate.createStatus("zalando-stups", "blub", "abcdefgh1234567", request); Assertions.assertThat(status).isNotNull(); Assertions.assertThat(status.getId()).isEqualTo(1); Assertions.assertThat(status.getUrl()).isEqualTo("https: }
@Override public Status createStatus(String owner, String repository, String sha, StatusRequest body) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("owner", owner); uriVariables.put("repository", repository); uriVariables.put("sha", sha); URI uri = new UriTemplate(buildUriString("/repos/{owner}/{repository}/statuses/{sha}")).expand(uriVariables); RequestEntity<StatusRequest> entity = RequestEntity.post(uri).contentType(MediaType.APPLICATION_JSON) .body(body); ResponseEntity<Status> responseEntity = getRestOperations().exchange(entity, Status.class); return responseEntity.getBody(); }
StatusesTemplate extends AbstractGithubTemplate implements StatusesOperations { @Override public Status createStatus(String owner, String repository, String sha, StatusRequest body) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("owner", owner); uriVariables.put("repository", repository); uriVariables.put("sha", sha); URI uri = new UriTemplate(buildUriString("/repos/{owner}/{repository}/statuses/{sha}")).expand(uriVariables); RequestEntity<StatusRequest> entity = RequestEntity.post(uri).contentType(MediaType.APPLICATION_JSON) .body(body); ResponseEntity<Status> responseEntity = getRestOperations().exchange(entity, Status.class); return responseEntity.getBody(); } }
StatusesTemplate extends AbstractGithubTemplate implements StatusesOperations { @Override public Status createStatus(String owner, String repository, String sha, StatusRequest body) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("owner", owner); uriVariables.put("repository", repository); uriVariables.put("sha", sha); URI uri = new UriTemplate(buildUriString("/repos/{owner}/{repository}/statuses/{sha}")).expand(uriVariables); RequestEntity<StatusRequest> entity = RequestEntity.post(uri).contentType(MediaType.APPLICATION_JSON) .body(body); ResponseEntity<Status> responseEntity = getRestOperations().exchange(entity, Status.class); return responseEntity.getBody(); } StatusesTemplate(RestOperations restOperations); }
StatusesTemplate extends AbstractGithubTemplate implements StatusesOperations { @Override public Status createStatus(String owner, String repository, String sha, StatusRequest body) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("owner", owner); uriVariables.put("repository", repository); uriVariables.put("sha", sha); URI uri = new UriTemplate(buildUriString("/repos/{owner}/{repository}/statuses/{sha}")).expand(uriVariables); RequestEntity<StatusRequest> entity = RequestEntity.post(uri).contentType(MediaType.APPLICATION_JSON) .body(body); ResponseEntity<Status> responseEntity = getRestOperations().exchange(entity, Status.class); return responseEntity.getBody(); } StatusesTemplate(RestOperations restOperations); @Override Status createStatus(String owner, String repository, String sha, StatusRequest body); @Override List<Status> listStatuses(String owner, String repository,String ref); @Override CombinedStatus getCombinedStatus(String owner, String repository, String ref); }
StatusesTemplate extends AbstractGithubTemplate implements StatusesOperations { @Override public Status createStatus(String owner, String repository, String sha, StatusRequest body) { Map<String, Object> uriVariables = new HashMap<>(); uriVariables.put("owner", owner); uriVariables.put("repository", repository); uriVariables.put("sha", sha); URI uri = new UriTemplate(buildUriString("/repos/{owner}/{repository}/statuses/{sha}")).expand(uriVariables); RequestEntity<StatusRequest> entity = RequestEntity.post(uri).contentType(MediaType.APPLICATION_JSON) .body(body); ResponseEntity<Status> responseEntity = getRestOperations().exchange(entity, Status.class); return responseEntity.getBody(); } StatusesTemplate(RestOperations restOperations); @Override Status createStatus(String owner, String repository, String sha, StatusRequest body); @Override List<Status> listStatuses(String owner, String repository,String ref); @Override CombinedStatus getCombinedStatus(String owner, String repository, String ref);  }