public static Matcher<? super ServiceProviderToken> equalTo(ServiceProviderToken token) {
Consumer consumer = token.getConsumer();
Matcher<?> consumerMatcher =
consumer == null ? nullValue() : samePropertyValuesAs(consumer);
ServiceProviderToken.Session session = token.getSession();
Matcher<?> sessionMatcher =
session == null ? nullValue() : samePropertyValuesAs(session);
return allOf(hasProperty("consumer", consumerMatcher),
hasProperty("session", sessionMatcher),
hasProperty("authorization", is(token.getAuthorization())),
hasProperty("callback", is(token.getCallback())),
hasProperty("creationTime", is(token.getCreationTime())),
hasProperty("timeToLive", is(token.getTimeToLive())),
hasProperty("user", is(token.getUser())),
hasProperty("verifier", is(token.getVerifier())),
hasProperty("version", is(token.getVersion())),
hasProperty("properties", is(token.getProperties())),
hasProperty("token", is(token.getToken())),
hasProperty("tokenSecret", is(token.getTokenSecret())));
}