PartnerTemplate implements PartnerOperations { public void updateApplication(URI applicationUri, ApplicationData applicationData) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<ApplicationData> requestEntity = new HttpEntity<ApplicationData>(applicationData, headers); restOperations.exchange(applicationUri, HttpMethod.PUT, requestEntity, String.class); } 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 updateApplication_withKey() { String applicationDataJson = "{\"name\":\"com.foo.bar\",\"push_service_status\":\"development\",\"certificate\":\"somecertificate\",\"certificate_password\":\"certpassword\"}"; mockServer.expect(requestTo("https: .andExpect(method(PUT)) .andExpect(body(applicationDataJson)) .andRespond(withResponse(applicationDataJson, responseHeaders, HttpStatus.OK, "OK")); ApplicationData applicationData = new ApplicationData("com.foo.bar", PushServiceStatus.DEVELOPMENT, "somecertificate", "certpassword"); urbanAirship.partnerOperations().updateApplication("XYZ123", applicationData); mockServer.verify(); }
@Test public void updateApplication_withUri() { URI applicationUri = URI.create("https: String applicationDataJson = "{\"name\":\"com.foo.bar\",\"push_service_status\":\"development\",\"certificate\":\"somecertificate\",\"certificate_password\":\"certpassword\"}"; mockServer.expect(requestTo("https: .andExpect(method(PUT)) .andExpect(body(applicationDataJson)) .andRespond(withResponse(applicationDataJson, responseHeaders, HttpStatus.OK, "OK")); ApplicationData applicationData = new ApplicationData("com.foo.bar", PushServiceStatus.DEVELOPMENT, "somecertificate", "certpassword"); urbanAirship.partnerOperations().updateApplication(applicationUri, applicationData); mockServer.verify(); }