@Test
public void testScopeMatcherByCompany() throws Exception {

	String applicationName2 = "com.liferay.test2";
	ScopeFinder service = () -> scopesSet1;
	Set<String> matchScopes = Collections.singleton("everything.readonly");
	ScopeMatcherFactory explicitScopeMatcherFactory = scopeAlias ->
		scope -> scope.equals(scopeAlias) && matchScopes.contains(scope);
	Builder builder = new Builder();
	ScopeLocatorImpl scopeLocatorImpl = builder.withScopeFinders(
		registrator -> {
			registrator.register(_COMPANY_ID, _APPLICATION_NAME, service);
			registrator.register(_COMPANY_ID, applicationName2, service);
		}
	).withScopeMatcherFactories(
		scopeAlias -> scopeAlias::equals,
		registrator -> registrator.register(
			String.valueOf(_COMPANY_ID), explicitScopeMatcherFactory)
	).build();
	Collection<LiferayOAuth2Scope> matchedLiferayOAuth2Scopes =
		scopeLocatorImpl.getLiferayOAuth2Scopes(
			_COMPANY_ID, "everything", _APPLICATION_NAME);
	Set<String> matchedScopes = _getScopes(matchedLiferayOAuth2Scopes);
	Assert.assertFalse(matchedScopes.contains("everything"));
	matchedLiferayOAuth2Scopes = scopeLocatorImpl.getLiferayOAuth2Scopes(
		_COMPANY_ID, "everything.readonly", _APPLICATION_NAME);
	matchedScopes = _getScopes(matchedLiferayOAuth2Scopes);
	Assert.assertTrue(matchedScopes.contains("everything.readonly"));
}