private void assertThatInterceptorWritesAuthorizationHeader(OAuth2RequestInterceptor interceptor, final String expected) throws Exception {
byte[] body = "status=Hello+there".getBytes();
MockHttpServletRequest request = new MockHttpServletRequest(HttpMethod.POST.name(), "https://api.someprovider.com/status/update");
request.setContentType(MediaType.APPLICATION_FORM_URLENCODED.toString());
ClientHttpRequestExecution execution = new ClientHttpRequestExecution() {
public ClientHttpResponse execute(HttpRequest request, byte[] body) throws IOException {
String authorizationHeader = request.getHeaders().getFirst("Authorization");
assertEquals(expected, authorizationHeader);
assertEquals(MediaType.APPLICATION_FORM_URLENCODED, request.getHeaders().getContentType());
return null;