@Override
    public void execute(final ConnectionSession connectionSession) {
        String databaseName = SQLUtils.getExactlyValue(useStatement.getDatabase());
        AuthorityRule authorityRule = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getSingleRule(AuthorityRule.class);
        AuthorityChecker authorityChecker = new AuthorityChecker(authorityRule, connectionSession.getConnectionContext().getGrantee());
        ShardingSpherePreconditions.checkState(ProxyContext.getInstance().databaseExists(databaseName) && authorityChecker.isAuthorized(databaseName),
                () -> new UnknownDatabaseException(databaseName));
        connectionSession.setCurrentDatabaseName(databaseName);
    }
@Test
    void assertExecuteUseStatementBackendHandlerWhenSchemaNotExist() {
        MySQLUseStatement useStatement = mock(MySQLUseStatement.class);
        when(useStatement.getDatabase()).thenReturn(String.format(DATABASE_PATTERN, 10));
        UseDatabaseExecutor executor = new UseDatabaseExecutor(useStatement);
        ContextManager contextManager = mockContextManager();
        when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
        assertThrows(UnknownDatabaseException.class, () -> executor.execute(connectionSession));
    }