diff --git a/CHANGELOG.md b/CHANGELOG.md index 996ab409b..67ce1b663 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,3 +13,4 @@ - [Test: remote deprecated method in test](https://github.com/Tencent/spring-cloud-tencent/pull/706) - [docs:update README.](https://github.com/Tencent/spring-cloud-tencent/pull/718) - [Code optimization & correct comment](https://github.com/Tencent/spring-cloud-tencent/pull/722) +- [fix:fix discovery junit.](https://github.com/Tencent/spring-cloud-tencent/pull/725) diff --git a/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/discovery/PolarisDiscoveryClientTest.java b/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/discovery/PolarisDiscoveryClientTest.java index 303f39736..41da53413 100644 --- a/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/discovery/PolarisDiscoveryClientTest.java +++ b/spring-cloud-starter-tencent-polaris-discovery/src/test/java/com/tencent/cloud/polaris/discovery/PolarisDiscoveryClientTest.java @@ -32,6 +32,7 @@ import static com.tencent.polaris.test.common.Consts.SERVICE_PROVIDER; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -63,7 +64,8 @@ public class PolarisDiscoveryClientTest { @Test public void testGetServices() { - when(polarisServiceDiscovery.getServices()).thenReturn(singletonList(SERVICE_PROVIDER)); +// when(polarisServiceDiscovery.getServices()).thenReturn(singletonList(SERVICE_PROVIDER)); + doReturn(singletonList(SERVICE_PROVIDER)).when(polarisServiceDiscovery).getServices(); List services = client.getServices();