From 5ec883dcef5a872d16b58774629f2f2d4350a48b Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Mon, 7 Oct 2024 19:25:08 +0800 Subject: [PATCH] Fix ReadwriteSplittingSQLRouterTest (#33147) --- .../route/ReadwriteSplittingSQLRouterTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingSQLRouterTest.java b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingSQLRouterTest.java index 9f6b3eac202ba..e0df7dd33d8f3 100644 --- a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingSQLRouterTest.java +++ b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingSQLRouterTest.java @@ -47,7 +47,9 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import java.util.Iterator; import java.util.Optional; import java.util.Properties; @@ -110,9 +112,7 @@ void assertDecorateRouteContextToReplicaDataSource() { mock(DatabaseType.class), mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), ruleMetaData, Collections.emptyMap()); RouteContext actual = mockRouteContext(); sqlRouter.decorateRouteContext(actual, queryContext, database, staticRule, new ConfigurationProperties(new Properties())); - Iterator routedDataSourceNames = actual.getActualDataSourceNames().iterator(); - assertThat(routedDataSourceNames.next(), is(NONE_READWRITE_SPLITTING_DATASOURCE_NAME)); - assertThat(routedDataSourceNames.next(), is(READ_DATASOURCE)); + assertThat(actual.getActualDataSourceNames(), is(new HashSet<>(Arrays.asList(NONE_READWRITE_SPLITTING_DATASOURCE_NAME, READ_DATASOURCE)))); } @Test