@Test(expected = AccessTokenRequiredException.class)
public void testNoRetryAccessDeniedExceptionForNoExistingToken() throws Exception {
restTemplate.setAccessTokenProvider(new StubAccessTokenProvider());
restTemplate.setRequestFactory(new ClientHttpRequestFactory() {
public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException {
throw new AccessTokenRequiredException(resource);
}
});
restTemplate.doExecute(new URI("http://foo"), HttpMethod.GET, new NullRequestCallback(),
new SimpleResponseExtractor());
}