PartnerTemplate implements PartnerOperations { public URI createApplication(ApplicationData applicationData) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<ApplicationData> requestEntity = new HttpEntity<ApplicationData>(applicationData, headers); ResponseEntity<String> responseEntity = restOperations.exchange(URBANAIRSHIP_API_URL + "partner/apps", HttpMethod.POST, requestEntity, String.class); return responseEntity.getHeaders().getLocation(); } PartnerTemplate(RestOperations restOperations); List<Application> getApplications(); URI createApplication(ApplicationData applicationData); void updateApplication(URI applicationUri, ApplicationData applicationData); void updateApplication(String applicationKey, ApplicationData applicationData);  }
@Test public void createApplication() { responseHeaders.setLocation(URI.create("https: String applicationDataJson = "{\"name\":\"com.foo.bar\",\"push_service_status\":\"development\",\"certificate\":\"somecertificate\",\"certificate_password\":\"certpassword\"}"; mockServer.expect(requestTo("https: .andExpect(method(POST)) .andExpect(body(applicationDataJson)) .andRespond(withResponse(applicationDataJson, responseHeaders, HttpStatus.CREATED, "Created")); ApplicationData applicationData = new ApplicationData("com.foo.bar", PushServiceStatus.DEVELOPMENT, "somecertificate", "certpassword"); URI applicationUrl = urbanAirship.partnerOperations().createApplication(applicationData); assertEquals(URI.create("https: mockServer.verify(); }