You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2023/05/15 04:32:17 UTC
[shardingsphere] branch master updated: Fix sonar issue of TablesContextTest (#25672)
This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 9353d8a6687 Fix sonar issue of TablesContextTest (#25672)
9353d8a6687 is described below
commit 9353d8a66878c48a2cb5984657c888213b3ad42f
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon May 15 12:32:10 2023 +0800
Fix sonar issue of TablesContextTest (#25672)
* Fix sonar issue of TokenUtilsTest
* Fix sonar issue of TablesContextTest
---
.../infra/binder/segment/table/TablesContextTest.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java
index ad280872546..2db9acdb3d7 100644
--- a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java
+++ b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java
@@ -34,6 +34,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -58,8 +59,11 @@ class TablesContextTest {
void assertInstanceCreatedWhenNoExceptionThrown() {
SimpleTableSegment tableSegment = new SimpleTableSegment(new TableNameSegment(0, 10, new IdentifierValue("tbl")));
tableSegment.setOwner(new OwnerSegment(0, 0, new IdentifierValue("schema")));
- new TablesContext(Collections.singleton(tableSegment), DatabaseTypeEngine.getDatabaseType("MySQL"));
- // TODO add assertion
+ TablesContext tablesContext = new TablesContext(Collections.singleton(tableSegment), DatabaseTypeEngine.getDatabaseType("MySQL"));
+ assertThat(tablesContext.getDatabaseName(), is(Optional.of("schema")));
+ assertThat(tablesContext.getSchemaName(), is(Optional.of("schema")));
+ assertThat(tablesContext.getTableNames(), is(Collections.singleton("tbl")));
+ assertTrue(tablesContext.getSubqueryTables().isEmpty());
}
@Test