Fix compile errors in Eclipse (STS 3.6.4) in UserInfoTokenServicesTests

This commit is contained in:
Andy Wilkinson 2015-09-22 12:54:39 +01:00
parent d10dd13714
commit a38f01f9e5
1 changed files with 5 additions and 5 deletions

View File

@ -36,6 +36,7 @@ import org.springframework.security.oauth2.common.exceptions.InvalidTokenExcepti
import static org.junit.Assert.assertEquals;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
/**
@ -57,12 +58,12 @@ public class UserInfoTokenServicesTests {
private Map<String, Object> map = new LinkedHashMap<String, Object>();
@SuppressWarnings("rawtypes")
@Before
@SuppressWarnings({ "unchecked", "rawtypes" })
public void init() {
this.resource.setClientId("foo");
given(this.template.getForEntity(any(String.class), any(Class.class)))
.willReturn(new ResponseEntity<Map>(this.map, HttpStatus.OK));
given(this.template.getForEntity(any(String.class), eq(Map.class))).willReturn(
new ResponseEntity<Map>(this.map, HttpStatus.OK));
given(this.template.getAccessToken()).willReturn(
new DefaultOAuth2AccessToken("FOO"));
given(this.template.getResource()).willReturn(this.resource);
@ -76,11 +77,10 @@ public class UserInfoTokenServicesTests {
assertEquals("unknown", this.services.loadAuthentication("FOO").getName());
}
@SuppressWarnings("unchecked")
@Test
public void badToken() {
this.services.setRestTemplate(this.template);
given(this.template.getForEntity(any(String.class), any(Class.class))).willThrow(
given(this.template.getForEntity(any(String.class), eq(Map.class))).willThrow(
new UserRedirectRequiredException("foo:bar", Collections
.<String, String>emptyMap()));
this.expected.expect(InvalidTokenException.class);