Update TestDefaultIntrospectionResultAssembler.java
parent
33b41af806
commit
1d54151be9
|
@ -37,13 +37,16 @@ import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||||
import org.springframework.security.oauth2.provider.OAuth2Request;
|
import org.springframework.security.oauth2.provider.OAuth2Request;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
|
import static org.hamcrest.CoreMatchers.not;
|
||||||
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
||||||
|
import static org.mockito.Mockito.doThrow;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
@ -176,6 +179,20 @@ public class TestDefaultIntrospectionResultAssembler {
|
||||||
assertThat(result, is(equalTo(expected)));
|
assertThat(result, is(equalTo(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// @Test(expected = ParseException.class)
|
||||||
|
// public void ABC() {
|
||||||
|
//
|
||||||
|
// // given
|
||||||
|
// OAuth2AccessTokenEntity accessToken = accessToken(new Date(123 * 1000L), scopes("foo", "bar"), null, "Bearer",
|
||||||
|
// oauth2AuthenticationWithUser(oauth2Request("clientId"), "name"));
|
||||||
|
//
|
||||||
|
// UserInfo userInfo = userInfo("sub");
|
||||||
|
//
|
||||||
|
// Set<String> authScopes = scopes("foo", "bar", "baz");
|
||||||
|
//
|
||||||
|
// assembler.assembleFrom(accessToken, userInfo, authScopes);}
|
||||||
|
//
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldAssembleExpectedResultForAccessTokenWithoutUserAuthentication() throws ParseException {
|
public void shouldAssembleExpectedResultForAccessTokenWithoutUserAuthentication() throws ParseException {
|
||||||
|
@ -304,6 +321,7 @@ public class TestDefaultIntrospectionResultAssembler {
|
||||||
assertThat(result, is(equalTo(expected)));
|
assertThat(result, is(equalTo(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test(expected= ParseException.class)
|
@Test(expected= ParseException.class)
|
||||||
public void testAssembleFrom_OAuth2AccessTokenEntityExpiration() throws ParseException{
|
public void testAssembleFrom_OAuth2AccessTokenEntityExpiration() throws ParseException{
|
||||||
|
|
||||||
|
@ -370,6 +388,9 @@ public class TestDefaultIntrospectionResultAssembler {
|
||||||
assertThat(result, is(not(equalTo(expected))));
|
assertThat(result, is(not(equalTo(expected))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private UserInfo userInfo(String sub) {
|
private UserInfo userInfo(String sub) {
|
||||||
UserInfo userInfo = mock(UserInfo.class);
|
UserInfo userInfo = mock(UserInfo.class);
|
||||||
given(userInfo.getSub()).willReturn(sub);
|
given(userInfo.getSub()).willReturn(sub);
|
||||||
|
|
Loading…
Reference in New Issue