/**
* test onValidSignature
*/
@Test
public void testOnValidSignature() throws Exception {
final OAuthProviderToken authToken = mock(OAuthProviderToken.class);
UnauthenticatedRequestTokenProcessingFilter filter = new UnauthenticatedRequestTokenProcessingFilter() {
@Override
protected OAuthProviderToken createOAuthToken(ConsumerAuthentication authentication) {
return authToken;
}
};
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
FilterChain filterChain = mock(FilterChain.class);
ConsumerCredentials creds = new ConsumerCredentials("key", "sig", "meth", "base", "tok");
ConsumerDetails consumerDetails = mock(ConsumerDetails.class);
when(authToken.getConsumerKey()).thenReturn("chi");
when(authToken.getValue()).thenReturn("tokvalue");
when(authToken.getSecret()).thenReturn("shhhhhh");
when(consumerDetails.getAuthorities()).thenReturn(new ArrayList<GrantedAuthority>());
when(consumerDetails.getConsumerKey()).thenReturn("chi");
response.setContentType("text/plain;charset=utf-8");
StringWriter writer = new StringWriter();
when(response.getWriter()).thenReturn(new PrintWriter(writer));