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