}
// ------------------------------- Test Methods for matching Credentials
public void testScopeMatching() {
AuthScope authscope1 = new AuthScope("somehost", 80, "somerealm", "somescheme");
AuthScope authscope2 = new AuthScope("someotherhost", 80, "somerealm", "somescheme");
assertTrue(authscope1.match(authscope2) < 0);
int m1 = authscope1.match(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, "somescheme"));
int m2 = authscope1.match(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, "somerealm", AuthScope.ANY_SCHEME));
assertTrue(m2 > m1);
m1 = authscope1.match(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, "somescheme"));
m2 = authscope1.match(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, "somerealm", AuthScope.ANY_SCHEME));
assertTrue(m2 > m1);
m1 = authscope1.match(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, "somerealm", "somescheme"));
m2 = authscope1.match(
new AuthScope(AuthScope.ANY_HOST, 80, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME));
assertTrue(m2 > m1);
m1 = authscope1.match(
new AuthScope(AuthScope.ANY_HOST, 80, "somerealm", "somescheme"));
m2 = authscope1.match(
new AuthScope("somehost", AuthScope.ANY_PORT, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME));
assertTrue(m2 > m1);
m1 = authscope1.match(AuthScope.ANY);
m2 = authscope1.match(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, "somescheme"));
assertTrue(m2 > m1);
}