Skip to content

Commit

Permalink
Fix sonar issue (#29538)
Browse files Browse the repository at this point in the history
* Fix sonar issue

* Fix code style
  • Loading branch information
Pace2Car authored Dec 25, 2023
1 parent 6871b70 commit add2466
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable;

import org.apache.shardingsphere.distsql.statement.ral.updatable.RefreshDatabaseMetaDataStatement;
import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.UnknownDatabaseException;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
Expand All @@ -27,8 +28,7 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;

import java.sql.SQLException;

import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand All @@ -41,9 +41,9 @@ class RefreshDatabaseMetaDataUpdaterTest {
private ConnectionSession connectionSession;

@Test
void assertExecuteWithNoDatabase() throws SQLException {
void assertExecuteWithNoDatabase() {
RefreshDatabaseMetaDataUpdater updater = new RefreshDatabaseMetaDataUpdater();
when(ProxyContext.getInstance().getContextManager()).thenReturn(mock(ContextManager.class, RETURNS_DEEP_STUBS));
updater.executeUpdate(connectionSession, mock(RefreshDatabaseMetaDataStatement.class));
assertThrows(UnknownDatabaseException.class, () -> updater.executeUpdate(connectionSession, new RefreshDatabaseMetaDataStatement("foo", true)));
}
}

0 comments on commit add2466

Please sign in to comment.