diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/ConfiguratorTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/ConfiguratorTest.java index 4db2ddf6cf..84e8468b21 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/ConfiguratorTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/ConfiguratorTest.java @@ -20,6 +20,7 @@ import org.apache.dubbo.common.URL; import org.apache.dubbo.rpc.cluster.configurator.absent.AbsentConfigurator; import org.apache.dubbo.rpc.cluster.configurator.override.OverrideConfigurator; import org.apache.dubbo.rpc.cluster.configurator.parser.ConfigParser; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -30,10 +31,10 @@ import java.util.Optional; /** * {@link Configurator} */ -public class ConfiguratorTest { +class ConfiguratorTest { @Test - public void test() throws Exception { + void test() throws Exception { Optional> emptyOptional = Configurator.toConfigurators(Collections.emptyList()); Assertions.assertEquals(Optional.empty(), emptyOptional); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/RouterChainTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/RouterChainTest.java index 96c325b449..b5edc67ed5 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/RouterChainTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/RouterChainTest.java @@ -51,13 +51,13 @@ import static org.apache.dubbo.common.constants.CommonConstants.TAG_KEY; import static org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleConstants.MESH_RULE_DATA_ID_SUFFIX; import static org.mockito.Mockito.when; -public class RouterChainTest { +class RouterChainTest { /** * verify the router and state router loaded by default */ @Test - public void testBuildRouterChain() { + void testBuildRouterChain() { RouterChain routerChain = createRouterChanin(); Assertions.assertEquals(0, routerChain.getRouters().size()); Assertions.assertEquals(5, routerChain.getStateRouters().size()); @@ -78,7 +78,7 @@ public class RouterChainTest { } @Test - public void testRoute() { + void testRoute() { RouterChain routerChain = createRouterChanin(); // mockInvoker will be filtered out by MockInvokersSelector diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/StickyTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/StickyTest.java index eddd7f6145..d19cf3f720 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/StickyTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/StickyTest.java @@ -38,7 +38,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; @SuppressWarnings("unchecked") -public class StickyTest { +class StickyTest { private List> invokers = new ArrayList>(); @@ -74,33 +74,33 @@ public class StickyTest { } @Test - public void testStickyNoCheck() { + void testStickyNoCheck() { int count = testSticky("t1", false); System.out.println(count); Assertions.assertTrue(count > 0 && count <= runs); } @Test - public void testStickyForceCheck() { + void testStickyForceCheck() { int count = testSticky("t2", true); Assertions.assertTrue(count == 0 || count == runs); } @Test - public void testMethodStickyNoCheck() { + void testMethodStickyNoCheck() { int count = testSticky("method1", false); System.out.println(count); Assertions.assertTrue(count > 0 && count <= runs); } @Test - public void testMethodStickyForceCheck() { + void testMethodStickyForceCheck() { int count = testSticky("method1", true); Assertions.assertTrue(count == 0 || count == runs); } @Test - public void testMethodsSticky() { + void testMethodsSticky() { for (int i = 0; i < 100; i++) {//Two different methods should always use the same invoker every time. int count1 = testSticky("method1", true); int count2 = testSticky("method2", true); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/absent/AbsentConfiguratorTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/absent/AbsentConfiguratorTest.java index 155f1a50b7..ec862a9358 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/absent/AbsentConfiguratorTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/absent/AbsentConfiguratorTest.java @@ -29,11 +29,11 @@ import java.util.Map; /** * OverrideConfiguratorTest */ -public class AbsentConfiguratorTest { +class AbsentConfiguratorTest { @Test - public void testOverrideApplication() { + void testOverrideApplication() { AbsentConfigurator configurator = new AbsentConfigurator(URL.valueOf("override://foo@0.0.0.0/com.foo.BarService?timeout=200")); URL url = configurator.configure(URL.valueOf(UrlConstant.URL_CONSUMER)); @@ -50,7 +50,7 @@ public class AbsentConfiguratorTest { } @Test - public void testOverrideHost() { + void testOverrideHost() { AbsentConfigurator configurator = new AbsentConfigurator(URL.valueOf("override://" + NetUtils.getLocalHost() + "/com.foo.BarService?timeout=200")); URL url = configurator.configure(URL.valueOf(UrlConstant.URL_CONSUMER)); @@ -70,7 +70,7 @@ public class AbsentConfiguratorTest { // Test the version after 2.7 @Test - public void testAbsentForVersion27() { + void testAbsentForVersion27() { { String consumerUrlV27 = "dubbo://172.24.160.179/com.foo.BarService?application=foo&side=consumer&timeout=100"; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/override/OverrideConfiguratorTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/override/OverrideConfiguratorTest.java index cad4e10d5e..c05238ac67 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/override/OverrideConfiguratorTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/override/OverrideConfiguratorTest.java @@ -30,10 +30,10 @@ import java.util.Map; /** * OverrideConfiguratorTest */ -public class OverrideConfiguratorTest { +class OverrideConfiguratorTest { @Test - public void testOverride_Application() { + void testOverride_Application() { OverrideConfigurator configurator = new OverrideConfigurator(URL.valueOf("override://foo@0.0.0.0/com.foo.BarService?timeout=200")); URL url = configurator.configure(URL.valueOf(UrlConstant.URL_CONSUMER)); @@ -50,7 +50,7 @@ public class OverrideConfiguratorTest { } @Test - public void testOverride_Host() { + void testOverride_Host() { OverrideConfigurator configurator = new OverrideConfigurator(URL.valueOf("override://" + NetUtils.getLocalHost() + "/com.foo.BarService?timeout=200")); URL url = configurator.configure(URL.valueOf(UrlConstant.URL_CONSUMER)); @@ -70,7 +70,7 @@ public class OverrideConfiguratorTest { // Test the version after 2.7 @Test - public void testOverrideForVersion27() { + void testOverrideForVersion27() { { String consumerUrlV27 = "dubbo://172.24.160.179/com.foo.BarService?application=foo&side=consumer&timeout=100"; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParserTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParserTest.java index 91b4360fe8..897d85ad9c 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParserTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParserTest.java @@ -37,7 +37,7 @@ import static org.apache.dubbo.rpc.cluster.Constants.WEIGHT_KEY; /** * */ -public class ConfigParserTest { +class ConfigParserTest { private String streamToString(InputStream stream) throws IOException { byte[] bytes = new byte[stream.available()]; @@ -46,7 +46,7 @@ public class ConfigParserTest { } @Test - public void snakeYamlBasicTest() throws IOException { + void snakeYamlBasicTest() throws IOException { try (InputStream yamlStream = this.getClass().getResourceAsStream("/ServiceNoApp.yml")) { Yaml yaml = new Yaml(new SafeConstructor()); Map map = yaml.load(yamlStream); @@ -56,7 +56,7 @@ public class ConfigParserTest { } @Test - public void parseConfiguratorsServiceNoAppTest() throws Exception { + void parseConfiguratorsServiceNoAppTest() throws Exception { try (InputStream yamlStream = this.getClass().getResourceAsStream("/ServiceNoApp.yml")) { List urls = ConfigParser.parseConfigurators(streamToString(yamlStream)); Assertions.assertNotNull(urls); @@ -68,7 +68,7 @@ public class ConfigParserTest { } @Test - public void parseConfiguratorsServiceGroupVersionTest() throws Exception { + void parseConfiguratorsServiceGroupVersionTest() throws Exception { try (InputStream yamlStream = this.getClass().getResourceAsStream("/ServiceGroupVersion.yml")) { List urls = ConfigParser.parseConfigurators(streamToString(yamlStream)); Assertions.assertNotNull(urls); @@ -80,7 +80,7 @@ public class ConfigParserTest { } @Test - public void parseConfiguratorsServiceMultiAppsTest() throws IOException { + void parseConfiguratorsServiceMultiAppsTest() throws IOException { try (InputStream yamlStream = this.getClass().getResourceAsStream("/ServiceMultiApps.yml")) { List urls = ConfigParser.parseConfigurators(streamToString(yamlStream)); Assertions.assertNotNull(urls); @@ -93,7 +93,7 @@ public class ConfigParserTest { } @Test - public void parseConfiguratorsServiceNoRuleTest() { + void parseConfiguratorsServiceNoRuleTest() { Assertions.assertThrows(IllegalStateException.class, () -> { try (InputStream yamlStream = this.getClass().getResourceAsStream("/ServiceNoRule.yml")) { ConfigParser.parseConfigurators(streamToString(yamlStream)); @@ -103,7 +103,7 @@ public class ConfigParserTest { } @Test - public void parseConfiguratorsAppMultiServicesTest() throws IOException { + void parseConfiguratorsAppMultiServicesTest() throws IOException { try (InputStream yamlStream = this.getClass().getResourceAsStream("/AppMultiServices.yml")) { String yamlFile = streamToString(yamlStream); List urls = ConfigParser.parseConfigurators(yamlFile); @@ -120,7 +120,7 @@ public class ConfigParserTest { @Test - public void parseConfiguratorsAppAnyServicesTest() throws IOException { + void parseConfiguratorsAppAnyServicesTest() throws IOException { try (InputStream yamlStream = this.getClass().getResourceAsStream("/AppAnyServices.yml")) { List urls = ConfigParser.parseConfigurators(streamToString(yamlStream)); Assertions.assertNotNull(urls); @@ -135,7 +135,7 @@ public class ConfigParserTest { } @Test - public void parseConfiguratorsAppNoServiceTest() throws IOException { + void parseConfiguratorsAppNoServiceTest() throws IOException { try (InputStream yamlStream = this.getClass().getResourceAsStream("/AppNoService.yml")) { List urls = ConfigParser.parseConfigurators(streamToString(yamlStream)); Assertions.assertNotNull(urls); @@ -150,7 +150,7 @@ public class ConfigParserTest { } @Test - public void parseConsumerSpecificProvidersTest() throws IOException { + void parseConsumerSpecificProvidersTest() throws IOException { try (InputStream yamlStream = this.getClass().getResourceAsStream("/ConsumerSpecificProviders.yml")) { List urls = ConfigParser.parseConfigurators(streamToString(yamlStream)); Assertions.assertNotNull(urls); @@ -166,7 +166,7 @@ public class ConfigParserTest { } @Test - public void parseURLJsonArrayCompatible() { + void parseURLJsonArrayCompatible() { String configData = "[\"override://0.0.0.0/com.xx.Service?category=configurators&timeout=6666&disabled=true&dynamic=false&enabled=true&group=dubbo&priority=1&version=1.0\" ]"; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/MockDirInvocation.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/MockDirInvocation.java index 246c7bdeec..3b40d9c818 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/MockDirInvocation.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/MockDirInvocation.java @@ -35,7 +35,7 @@ import static org.apache.dubbo.rpc.Constants.TOKEN_KEY; /** * MockInvocation.java */ -public class MockDirInvocation implements Invocation { +class MockDirInvocation implements Invocation { private Map attachments; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectoryTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectoryTest.java index 1be30ff983..379d50b1c1 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectoryTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectoryTest.java @@ -37,7 +37,7 @@ import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY; /** * StaticDirectory Test */ -public class StaticDirectoryTest { +class StaticDirectoryTest { private URL SCRIPT_URL = URL.valueOf("condition://0.0.0.0/com.foo.BarService"); private URL getRouteUrl(String rule) { @@ -45,7 +45,7 @@ public class StaticDirectoryTest { } @Test - public void testStaticDirectory() { + void testStaticDirectory() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl(" => " + " host = " + NetUtils.getLocalHost())); List routers = new ArrayList(); routers.add(router); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DefaultFilterChainBuilderTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DefaultFilterChainBuilderTest.java index 7a5779aa2c..a07a4157be 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DefaultFilterChainBuilderTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DefaultFilterChainBuilderTest.java @@ -31,10 +31,10 @@ import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER; import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY; import static org.apache.dubbo.common.constants.CommonConstants.REFERENCE_FILTER_KEY; -public class DefaultFilterChainBuilderTest { +class DefaultFilterChainBuilderTest { @Test - public void testBuildInvokerChainForLocalReference() { + void testBuildInvokerChainForLocalReference() { DefaultFilterChainBuilder defaultFilterChainBuilder = new DefaultFilterChainBuilder(); // verify that no filter is built by default @@ -69,7 +69,7 @@ public class DefaultFilterChainBuilderTest { } @Test - public void testBuildInvokerChainForRemoteReference() { + void testBuildInvokerChainForRemoteReference() { DefaultFilterChainBuilder defaultFilterChainBuilder = new DefaultFilterChainBuilder(); // verify that no filter is built by default diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceImpl.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceImpl.java index 9ccdd1b1c1..58f176aab8 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceImpl.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceImpl.java @@ -17,7 +17,7 @@ package org.apache.dubbo.rpc.cluster.filter; -public class DemoServiceImpl implements DemoService{ +class DemoServiceImpl implements DemoService{ @Override public String sayHello(String name) { diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceLocal.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceLocal.java index 8b92a59621..f7650da9c4 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceLocal.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceLocal.java @@ -20,7 +20,7 @@ package org.apache.dubbo.rpc.cluster.filter; * TestService */ -public class DemoServiceLocal implements DemoService { +class DemoServiceLocal implements DemoService { public DemoServiceLocal(DemoService demoService) { } diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceMock.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceMock.java index 7b0898dfd3..6ddf8c2bdc 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceMock.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceMock.java @@ -20,7 +20,7 @@ package org.apache.dubbo.rpc.cluster.filter; * MockService.java * */ -public class DemoServiceMock implements DemoService { +class DemoServiceMock implements DemoService { public String sayHello(String name) { return name; } diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceStub.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceStub.java index 6217ed6e19..d230eaf5b8 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceStub.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DemoServiceStub.java @@ -20,7 +20,7 @@ package org.apache.dubbo.rpc.cluster.filter; * TestService */ -public class DemoServiceStub implements DemoService { +class DemoServiceStub implements DemoService { public DemoServiceStub(DemoService demoService) { } diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/MockService.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/MockService.java index 5ae968afbb..d7d68180d8 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/MockService.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/MockService.java @@ -20,7 +20,7 @@ package org.apache.dubbo.rpc.cluster.filter; * MockService.java * */ -public class MockService implements DemoService { +class MockService implements DemoService { public String sayHello(String name) { return name; } diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalanceTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalanceTest.java index d1ce803f46..d5419a0a95 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalanceTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalanceTest.java @@ -35,7 +35,7 @@ import static org.apache.dubbo.rpc.cluster.Constants.WEIGHT_KEY; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -public class AbstractLoadBalanceTest { +class AbstractLoadBalanceTest { private AbstractLoadBalance balance = new AbstractLoadBalance() { @Override @@ -45,7 +45,7 @@ public class AbstractLoadBalanceTest { }; @Test - public void testGetWeight() { + void testGetWeight() { RpcInvocation invocation = new RpcInvocation(); invocation.setMethodName("say"); @@ -63,7 +63,7 @@ public class AbstractLoadBalanceTest { } @Test - public void testGetRegistryWeight() { + void testGetRegistryWeight() { RpcInvocation invocation = new RpcInvocation(); invocation.setMethodName("say"); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalanceTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalanceTest.java index e0deb95ea1..b5ae59fad6 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalanceTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalanceTest.java @@ -31,10 +31,10 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicLong; @SuppressWarnings("rawtypes") -public class ConsistentHashLoadBalanceTest extends LoadBalanceBaseTest { +class ConsistentHashLoadBalanceTest extends LoadBalanceBaseTest { @Test - public void testConsistentHashLoadBalanceInGenericCall() { + void testConsistentHashLoadBalanceInGenericCall() { int runs = 10000; Map genericInvokeCounter = getGenericInvokeCounter(runs, ConsistentHashLoadBalance.NAME); Map invokeCounter = getInvokeCounter(runs, ConsistentHashLoadBalance.NAME); @@ -62,7 +62,7 @@ public class ConsistentHashLoadBalanceTest extends LoadBalanceBaseTest { } @Test - public void testConsistentHashLoadBalance() { + void testConsistentHashLoadBalance() { int runs = 10000; long unHitedInvokerCount = 0; Map hitedInvokers = new HashMap<>(); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveBalanceTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveBalanceTest.java index 0e172e4b45..64ee44b863 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveBalanceTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveBalanceTest.java @@ -25,10 +25,10 @@ import org.junit.jupiter.api.Test; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; -public class LeastActiveBalanceTest extends LoadBalanceBaseTest { +class LeastActiveBalanceTest extends LoadBalanceBaseTest { @Disabled @Test - public void testLeastActiveLoadBalance_select() { + void testLeastActiveLoadBalance_select() { int runs = 10000; Map counter = getInvokeCounter(runs, LeastActiveLoadBalance.NAME); for (Map.Entry entry : counter.entrySet()) { @@ -40,7 +40,7 @@ public class LeastActiveBalanceTest extends LoadBalanceBaseTest { } @Test - public void testSelectByWeight() { + void testSelectByWeight() { int sumInvoker1 = 0; int sumInvoker2 = 0; int loop = 10000; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LoadBalanceBaseTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LoadBalanceBaseTest.java index cab69a1302..4e71762ab0 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LoadBalanceBaseTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LoadBalanceBaseTest.java @@ -46,7 +46,7 @@ import static org.mockito.Mockito.mock; * RoundRobinLoadBalanceTest */ @SuppressWarnings({"unchecked", "rawtypes"}) -public class LoadBalanceBaseTest { +class LoadBalanceBaseTest { Invocation invocation; Invocation genericInvocation; List> invokers = new ArrayList>(); @@ -160,7 +160,7 @@ public class LoadBalanceBaseTest { } @Test - public void testLoadBalanceWarmup() { + void testLoadBalanceWarmup() { Assertions.assertEquals(1, calculateDefaultWarmupWeight(0)); Assertions.assertEquals(1, calculateDefaultWarmupWeight(13)); Assertions.assertEquals(1, calculateDefaultWarmupWeight(6 * 1000)); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RandomLoadBalanceTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RandomLoadBalanceTest.java index 7bd0a76c11..f01ac1d526 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RandomLoadBalanceTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RandomLoadBalanceTest.java @@ -28,9 +28,9 @@ import java.util.concurrent.atomic.AtomicLong; /** * RandomLoadBalance Test */ -public class RandomLoadBalanceTest extends LoadBalanceBaseTest { +class RandomLoadBalanceTest extends LoadBalanceBaseTest { @Test - public void testRandomLoadBalanceSelect() { + void testRandomLoadBalanceSelect() { int runs = 1000; Map counter = getInvokeCounter(runs, RandomLoadBalance.NAME); for (Map.Entry entry : counter.entrySet()) { @@ -55,7 +55,7 @@ public class RandomLoadBalanceTest extends LoadBalanceBaseTest { } @Test - public void testSelectByWeight() { + void testSelectByWeight() { int sumInvoker1 = 0; int sumInvoker2 = 0; int sumInvoker3 = 0; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java index bb6260c967..0a407847be 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalanceTest.java @@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; @Disabled -public class RoundRobinLoadBalanceTest extends LoadBalanceBaseTest { +class RoundRobinLoadBalanceTest extends LoadBalanceBaseTest { private void assertStrictWRRResult(int loop, Map resultMap) { int invokeCount = 0; @@ -47,7 +47,7 @@ public class RoundRobinLoadBalanceTest extends LoadBalanceBaseTest { } @Test - public void testRoundRobinLoadBalanceSelect() { + void testRoundRobinLoadBalanceSelect() { int runs = 10000; Map counter = getInvokeCounter(runs, RoundRobinLoadBalance.NAME); for (Map.Entry entry : counter.entrySet()) { @@ -57,7 +57,7 @@ public class RoundRobinLoadBalanceTest extends LoadBalanceBaseTest { } @Test - public void testSelectByWeight() { + void testSelectByWeight() { final Map totalMap = new HashMap(); final AtomicBoolean shouldBegin = new AtomicBoolean(false); final int runs = 10000; @@ -98,7 +98,7 @@ public class RoundRobinLoadBalanceTest extends LoadBalanceBaseTest { } @Test - public void testNodeCacheShouldNotRecycle() { + void testNodeCacheShouldNotRecycle() { int loop = 10000; //tmperately add a new invoker weightInvokers.add(weightInvokerTmp); @@ -123,7 +123,7 @@ public class RoundRobinLoadBalanceTest extends LoadBalanceBaseTest { } @Test - public void testNodeCacheShouldRecycle() { + void testNodeCacheShouldRecycle() { { Field recycleTimeField = null; try { diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/ShortestResponseLoadBalanceTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/ShortestResponseLoadBalanceTest.java index 9d43790791..bf617a6923 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/ShortestResponseLoadBalanceTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/ShortestResponseLoadBalanceTest.java @@ -34,7 +34,7 @@ import java.util.function.Function; import java.util.stream.Collectors; @TestMethodOrder(MethodOrderer.OrderAnnotation.class) -public class ShortestResponseLoadBalanceTest extends LoadBalanceBaseTest { +class ShortestResponseLoadBalanceTest extends LoadBalanceBaseTest { @Test @Order(0) diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/merger/ResultMergerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/merger/ResultMergerTest.java index 8be8d86976..db0b83c1b4 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/merger/ResultMergerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/merger/ResultMergerTest.java @@ -35,7 +35,7 @@ import java.util.stream.IntStream; import java.util.stream.LongStream; import java.util.stream.Stream; -public class ResultMergerTest { +class ResultMergerTest { private MergerFactory mergerFactory; @BeforeEach @@ -48,7 +48,7 @@ public class ResultMergerTest { * MergerFactory test */ @Test - public void testMergerFactoryIllegalArgumentException() { + void testMergerFactoryIllegalArgumentException() { try { mergerFactory.getMerger(null); Assertions.fail("expected IllegalArgumentException for null argument"); @@ -61,7 +61,7 @@ public class ResultMergerTest { * ArrayMerger test */ @Test - public void testArrayMergerIllegalArgumentException() { + void testArrayMergerIllegalArgumentException() { String[] stringArray = {"1", "2", "3"}; Integer[] integerArray = {3, 4, 5}; try { @@ -76,7 +76,7 @@ public class ResultMergerTest { * ArrayMerger test */ @Test - public void testArrayMerger() { + void testArrayMerger() { String[] stringArray1 = {"1", "2", "3"}; String[] stringArray2 = {"4", "5", "6"}; String[] stringArray3 = {}; @@ -115,7 +115,7 @@ public class ResultMergerTest { * BooleanArrayMerger test */ @Test - public void testBooleanArrayMerger() { + void testBooleanArrayMerger() { boolean[] arrayOne = {true, false}; boolean[] arrayTwo = {false}; boolean[] result = mergerFactory.getMerger(boolean[].class).merge(arrayOne, arrayTwo, null); @@ -136,7 +136,7 @@ public class ResultMergerTest { * ByteArrayMerger test */ @Test - public void testByteArrayMerger() { + void testByteArrayMerger() { byte[] arrayOne = {1, 2}; byte[] arrayTwo = {1, 32}; byte[] result = mergerFactory.getMerger(byte[].class).merge(arrayOne, arrayTwo, null); @@ -157,7 +157,7 @@ public class ResultMergerTest { * CharArrayMerger test */ @Test - public void testCharArrayMerger() { + void testCharArrayMerger() { char[] arrayOne = "hello".toCharArray(); char[] arrayTwo = "world".toCharArray(); char[] result = mergerFactory.getMerger(char[].class).merge(arrayOne, arrayTwo, null); @@ -178,7 +178,7 @@ public class ResultMergerTest { * DoubleArrayMerger test */ @Test - public void testDoubleArrayMerger() { + void testDoubleArrayMerger() { double[] arrayOne = {1.2d, 3.5d}; double[] arrayTwo = {2d, 34d}; double[] result = mergerFactory.getMerger(double[].class).merge(arrayOne, arrayTwo, null); @@ -199,7 +199,7 @@ public class ResultMergerTest { * FloatArrayMerger test */ @Test - public void testFloatArrayMerger() { + void testFloatArrayMerger() { float[] arrayOne = {1.2f, 3.5f}; float[] arrayTwo = {2f, 34f}; float[] result = mergerFactory.getMerger(float[].class).merge(arrayOne, arrayTwo, null); @@ -220,7 +220,7 @@ public class ResultMergerTest { * IntArrayMerger test */ @Test - public void testIntArrayMerger() { + void testIntArrayMerger() { int[] arrayOne = {1, 2}; int[] arrayTwo = {2, 34}; int[] result = mergerFactory.getMerger(int[].class).merge(arrayOne, arrayTwo, null); @@ -241,7 +241,7 @@ public class ResultMergerTest { * ListMerger test */ @Test - public void testListMerger() { + void testListMerger() { List list1 = new ArrayList() {{ add(null); add("1"); @@ -274,7 +274,7 @@ public class ResultMergerTest { * LongArrayMerger test */ @Test - public void testMapArrayMerger() { + void testMapArrayMerger() { Map mapOne = new HashMap() {{ put("11", 222); put("223", 11); @@ -304,7 +304,7 @@ public class ResultMergerTest { * LongArrayMerger test */ @Test - public void testLongArrayMerger() { + void testLongArrayMerger() { long[] arrayOne = {1L, 2L}; long[] arrayTwo = {2L, 34L}; long[] result = mergerFactory.getMerger(long[].class).merge(arrayOne, arrayTwo, null); @@ -325,7 +325,7 @@ public class ResultMergerTest { * SetMerger test */ @Test - public void testSetMerger() { + void testSetMerger() { Set set1 = new HashSet() {{ add(null); add("1"); @@ -360,7 +360,7 @@ public class ResultMergerTest { * ShortArrayMerger test */ @Test - public void testShortArrayMerger() { + void testShortArrayMerger() { short[] arrayOne = {1, 2}; short[] arrayTwo = {2, 34}; short[] result = mergerFactory.getMerger(short[].class).merge(arrayOne, arrayTwo, null); @@ -381,7 +381,7 @@ public class ResultMergerTest { * IntSumMerger test */ @Test - public void testIntSumMerger() { + void testIntSumMerger() { Integer[] intArr = IntStream.rangeClosed(1, 100).boxed().toArray(Integer[]::new); Merger merger = ApplicationModel.defaultModel().getExtension(Merger.class, "intsum"); Assertions.assertEquals(5050, merger.merge(intArr)); @@ -394,7 +394,7 @@ public class ResultMergerTest { * DoubleSumMerger test */ @Test - public void testDoubleSumMerger() { + void testDoubleSumMerger() { Double[] doubleArr = DoubleStream.iterate(1, v -> ++v).limit(100).boxed().toArray(Double[]::new); Merger merger = ApplicationModel.defaultModel().getExtension(Merger.class, "doublesum"); Assertions.assertEquals(5050, merger.merge(doubleArr)); @@ -407,7 +407,7 @@ public class ResultMergerTest { * FloatSumMerger test */ @Test - public void testFloatSumMerger() { + void testFloatSumMerger() { Float[] floatArr = Stream.iterate(1.0F, v -> ++v).limit(100).toArray(Float[]::new); Merger merger = ApplicationModel.defaultModel().getExtension(Merger.class, "floatsum"); Assertions.assertEquals(5050, merger.merge(floatArr)); @@ -420,7 +420,7 @@ public class ResultMergerTest { * LongSumMerger test */ @Test - public void testLongSumMerger() { + void testLongSumMerger() { Long[] longArr = LongStream.rangeClosed(1, 100).boxed().toArray(Long[]::new); Merger merger = ApplicationModel.defaultModel().getExtension(Merger.class, "longsum"); Assertions.assertEquals(5050, merger.merge(longArr)); @@ -433,7 +433,7 @@ public class ResultMergerTest { * IntFindAnyMerger test */ @Test - public void testIntFindAnyMerger() { + void testIntFindAnyMerger() { Integer[] intArr = {1, 2, 3, 4}; Merger merger = ApplicationModel.defaultModel().getExtension(Merger.class, "intany"); Assertions.assertNotNull(merger.merge(intArr)); @@ -446,7 +446,7 @@ public class ResultMergerTest { * IntFindFirstMerger test */ @Test - public void testIntFindFirstMerger() { + void testIntFindFirstMerger() { Integer[] intArr = {1, 2, 3, 4}; Merger merger = ApplicationModel.defaultModel().getExtension(Merger.class, "intfirst"); Assertions.assertEquals(1, merger.merge(intArr)); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/ConfigConditionRouterTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/ConfigConditionRouterTest.java index 1235869a2e..8cc7f5b1d1 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/ConfigConditionRouterTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/ConfigConditionRouterTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @Disabled("FIXME This is not a formal UT") -public class ConfigConditionRouterTest { +class ConfigConditionRouterTest { private static CuratorFramework client; @BeforeEach @@ -35,7 +35,7 @@ public class ConfigConditionRouterTest { } @Test - public void normalConditionRuleApplicationLevelTest() { + void normalConditionRuleApplicationLevelTest() { String serviceStr = "---\n" + "scope: application\n" + "force: true\n" + @@ -58,7 +58,7 @@ public class ConfigConditionRouterTest { } @Test - public void normalConditionRuleApplicationServiceLevelTest() { + void normalConditionRuleApplicationServiceLevelTest() { String serviceStr = "---\n" + "scope: application\n" + "force: true\n" + @@ -82,7 +82,7 @@ public class ConfigConditionRouterTest { } @Test - public void normalConditionRuleServiceLevelTest() { + void normalConditionRuleServiceLevelTest() { String serviceStr = "---\n" + "scope: service\n" + "force: true\n" + @@ -107,7 +107,7 @@ public class ConfigConditionRouterTest { } @Test - public void abnormalNoruleConditionRuleTest() { + void abnormalNoruleConditionRuleTest() { String serviceStr = "---\n" + "scope: service\n" + "force: true\n" + diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/RouterSnapshotFilterTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/RouterSnapshotFilterTest.java index 1c67051390..76a01d87eb 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/RouterSnapshotFilterTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/RouterSnapshotFilterTest.java @@ -26,10 +26,10 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class RouterSnapshotFilterTest { +class RouterSnapshotFilterTest { @Test - public void test() { + void test() { FrameworkModel frameworkModel = new FrameworkModel(); RouterSnapshotSwitcher routerSnapshotSwitcher = frameworkModel.getBeanFactory().getBean(RouterSnapshotSwitcher.class); RouterSnapshotFilter routerSnapshotFilter = new RouterSnapshotFilter(frameworkModel); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouterTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouterTest.java index 1c6c799cad..0f01f0381d 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouterTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouterTest.java @@ -37,7 +37,7 @@ import java.util.List; import static org.apache.dubbo.rpc.cluster.Constants.FORCE_KEY; import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY; -public class ConditionStateRouterTest { +class ConditionStateRouterTest { private static final String LOCAL_HOST = "127.0.0.1"; private URL SCRIPT_URL = URL.valueOf("condition://0.0.0.0/com.foo.BarService"); @@ -54,7 +54,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_matchWhen() { + void testRoute_matchWhen() { Invocation invocation = new RpcInvocation(); StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl(" => host = 1.2.3.4")); @@ -87,7 +87,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_matchFilter() { + void testRoute_matchFilter() { List> originInvokers = new ArrayList>(); Invoker invoker1 = new MockInvoker(URL.valueOf( "dubbo://10.20.3.3:20880/com.foo.BarService?serialization=fastjson")); @@ -139,7 +139,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_methodRoute() { + void testRoute_methodRoute() { Invocation invocation = new RpcInvocation("getFoo", "com.foo.BarService", "", new Class[0], new Object[0]); // More than one methods, mismatch StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl("methods=getFoo => host = 1.2.3.4")); @@ -191,7 +191,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_ReturnFalse() { + void testRoute_ReturnFalse() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl("host = " + LOCAL_HOST + " => false")); List> originInvokers = new ArrayList>(); originInvokers.add(new MockInvoker()); @@ -204,7 +204,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_ReturnEmpty() { + void testRoute_ReturnEmpty() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl("host = " + LOCAL_HOST + " => ")); List> originInvokers = new ArrayList>(); originInvokers.add(new MockInvoker()); @@ -217,7 +217,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_ReturnAll() { + void testRoute_ReturnAll() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl("host = " + LOCAL_HOST + " => " + " host = " + LOCAL_HOST)); List> originInvokers = new ArrayList>(); originInvokers.add(new MockInvoker(URL.valueOf("dubbo://" + LOCAL_HOST + ":20880/com.foo.BarService"))); @@ -230,7 +230,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_HostFilter() { + void testRoute_HostFilter() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl("host = " + LOCAL_HOST + " => " + " host = " + LOCAL_HOST)); List> originInvokers = new ArrayList>(); Invoker invoker1 = new MockInvoker(URL.valueOf("dubbo://10.20.3.3:20880/com.foo.BarService")); @@ -248,7 +248,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_Empty_HostFilter() { + void testRoute_Empty_HostFilter() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl(" => " + " host = " + LOCAL_HOST)); List> originInvokers = new ArrayList>(); Invoker invoker1 = new MockInvoker(URL.valueOf("dubbo://10.20.3.3:20880/com.foo.BarService")); @@ -266,7 +266,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_False_HostFilter() { + void testRoute_False_HostFilter() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl("true => " + " host = " + LOCAL_HOST)); List> originInvokers = new ArrayList>(); Invoker invoker1 = new MockInvoker(URL.valueOf("dubbo://10.20.3.3:20880/com.foo.BarService")); @@ -284,7 +284,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_Placeholder() { + void testRoute_Placeholder() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl("host = " + LOCAL_HOST + " => " + " host = $host")); List> originInvokers = new ArrayList>(); Invoker invoker1 = new MockInvoker(URL.valueOf("dubbo://10.20.3.3:20880/com.foo.BarService")); @@ -302,7 +302,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_NoForce() { + void testRoute_NoForce() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl("host = " + LOCAL_HOST + " => " + " host = 1.2.3.4")); List> originInvokers = new ArrayList>(); Invoker invoker1 = new MockInvoker(URL.valueOf("dubbo://10.20.3.3:20880/com.foo.BarService")); @@ -318,7 +318,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_Force() { + void testRoute_Force() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl("host = " + LOCAL_HOST + " => " + " host = 1.2.3.4").addParameter(FORCE_KEY, String.valueOf(true))); List> originInvokers = new ArrayList>(); Invoker invoker1 = new MockInvoker(URL.valueOf("dubbo://10.20.3.3:20880/com.foo.BarService")); @@ -334,7 +334,7 @@ public class ConditionStateRouterTest { } @Test - public void testRoute_Arguments() { + void testRoute_Arguments() { StateRouter router = new ConditionStateRouterFactory().getRouter(String.class, getRouteUrl("arguments[0] = a " + " => " + " host = 1.2.3.4").addParameter(FORCE_KEY, String.valueOf(true))); List> originInvokers = new ArrayList<>(); Invoker invoker1 = new MockInvoker<>(URL.valueOf("dubbo://10.20.3.3:20880/com.foo.BarService")); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterEngineTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterEngineTest.java index 7c0d2d0781..ec56f58707 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterEngineTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterEngineTest.java @@ -47,7 +47,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; @SuppressWarnings("unchecked") -public class FileRouterEngineTest { +class FileRouterEngineTest { private static boolean isScriptUnsupported = new ScriptEngineManager().getEngineByName("javascript") == null; List> invokers = new ArrayList>(); Invoker invoker1 = mock(Invoker.class); @@ -75,7 +75,7 @@ public class FileRouterEngineTest { } @Test - public void testRouteNotAvailable() { + void testRouteNotAvailable() { if (isScriptUnsupported) return; URL url = initUrl("notAvailablerule.javascript"); initInvocation("method1"); @@ -92,7 +92,7 @@ public class FileRouterEngineTest { } @Test - public void testRouteAvailable() { + void testRouteAvailable() { if (isScriptUnsupported) return; URL url = initUrl("availablerule.javascript"); initInvocation("method1"); @@ -109,7 +109,7 @@ public class FileRouterEngineTest { } @Test - public void testRouteByMethodName() { + void testRouteByMethodName() { if (isScriptUnsupported) return; URL url = initUrl("methodrule.javascript"); { diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshAppRuleListenerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshAppRuleListenerTest.java index abf0a98d59..d089d33a76 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshAppRuleListenerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshAppRuleListenerTest.java @@ -40,7 +40,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -public class MeshAppRuleListenerTest { +class MeshAppRuleListenerTest { private final static String rule1 = "apiVersion: service.dubbo.apache.org/v1alpha1\n" + "kind: DestinationRule\n" + @@ -117,7 +117,7 @@ public class MeshAppRuleListenerTest { " hosts: [demo]\n"; @Test - public void testStandard() { + void testStandard() { MeshAppRuleListener meshAppRuleListener = new MeshAppRuleListener("demo-route"); StandardMeshRuleRouter standardMeshRuleRouter = Mockito.spy(new StandardMeshRuleRouter(URL.valueOf(""))); @@ -143,7 +143,7 @@ public class MeshAppRuleListenerTest { } @Test - public void register() { + void register() { MeshAppRuleListener meshAppRuleListener = new MeshAppRuleListener("demo-route"); StandardMeshRuleRouter standardMeshRuleRouter1 = Mockito.spy(new StandardMeshRuleRouter(URL.valueOf(""))); @@ -180,7 +180,7 @@ public class MeshAppRuleListenerTest { } @Test - public void unregister() { + void unregister() { MeshAppRuleListener meshAppRuleListener = new MeshAppRuleListener("demo-route"); StandardMeshRuleRouter standardMeshRuleRouter1 = Mockito.spy(new StandardMeshRuleRouter(URL.valueOf(""))); @@ -201,7 +201,7 @@ public class MeshAppRuleListenerTest { } @Test - public void process() { + void process() { MeshAppRuleListener meshAppRuleListener = new MeshAppRuleListener("demo-route"); StandardMeshRuleRouter standardMeshRuleRouter = Mockito.spy(new StandardMeshRuleRouter(URL.valueOf(""))); @@ -243,7 +243,7 @@ public class MeshAppRuleListenerTest { } @Test - public void testUnknownRule() { + void testUnknownRule() { MeshAppRuleListener meshAppRuleListener = new MeshAppRuleListener("demo-route"); StandardMeshRuleRouter standardMeshRuleRouter = Mockito.spy(new StandardMeshRuleRouter(URL.valueOf(""))); @@ -274,7 +274,7 @@ public class MeshAppRuleListenerTest { } @Test - public void testMultipleRule() { + void testMultipleRule() { MeshAppRuleListener meshAppRuleListener = new MeshAppRuleListener("demo-route"); AtomicInteger count = new AtomicInteger(0); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleCacheTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleCacheTest.java index 9dc9c5783b..0740faaa44 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleCacheTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleCacheTest.java @@ -39,7 +39,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class MeshRuleCacheTest { +class MeshRuleCacheTest { private Invoker createInvoker(String app) { URL url = URL.valueOf("dubbo://localhost/DemoInterface?" + (StringUtils.isEmpty(app) ? "" : "remote.application=" + app)); @@ -49,7 +49,7 @@ public class MeshRuleCacheTest { } @Test - public void containMapKeyValue() { + void containMapKeyValue() { URL url = mock(URL.class); when(url.getServiceKey()).thenReturn("test"); @@ -77,7 +77,7 @@ public class MeshRuleCacheTest { @Test - public void testBuild() { + void testBuild() { BitList> invokers = new BitList<>(Arrays.asList(createInvoker(""), createInvoker("unknown"), createInvoker("app1"))); Subset subset = new Subset(); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManagerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManagerTest.java index a9d600f1cd..4c07bddc27 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManagerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManagerTest.java @@ -44,7 +44,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class MeshRuleManagerTest { +class MeshRuleManagerTest { private final static String rule1 = "apiVersion: service.dubbo.apache.org/v1alpha1\n" + "kind: DestinationRule\n" + "metadata: { name: demo-route.Type1 }\n" + @@ -94,7 +94,7 @@ public class MeshRuleManagerTest { } @Test - public void testRegister1() { + void testRegister1() { MeshRuleManager meshRuleManager = new MeshRuleManager(moduleModel); MeshRuleListener meshRuleListener1 = new MeshRuleListener() { @@ -158,7 +158,7 @@ public class MeshRuleManagerTest { } @Test - public void testRegister2() { + void testRegister2() { MeshRuleManager meshRuleManager = new MeshRuleManager(moduleModel); AtomicInteger invokeTimes = new AtomicInteger(0); @@ -199,7 +199,7 @@ public class MeshRuleManagerTest { } @Test - public void testRegister3() { + void testRegister3() { MeshEnvListenerFactory meshEnvListenerFactory1 = Mockito.mock(MeshEnvListenerFactory.class); MeshEnvListenerFactory meshEnvListenerFactory2 = Mockito.mock(MeshEnvListenerFactory.class); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleRouterTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleRouterTest.java index 02b86f7ee0..979218beae 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleRouterTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleRouterTest.java @@ -52,7 +52,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class MeshRuleRouterTest { +class MeshRuleRouterTest { private final static String rule1 = "apiVersion: service.dubbo.apache.org/v1alpha1\n" + "kind: DestinationRule\n" + "metadata: { name: demo-route }\n" + @@ -210,7 +210,7 @@ public class MeshRuleRouterTest { @Test - public void testNotify() { + void testNotify() { StandardMeshRuleRouter meshRuleRouter = new StandardMeshRuleRouter<>(url); meshRuleRouter.notify(null); assertEquals(0, meshRuleRouter.getRemoteAppName().size()); @@ -236,7 +236,7 @@ public class MeshRuleRouterTest { } @Test - public void testRuleChange() { + void testRuleChange() { StandardMeshRuleRouter meshRuleRouter = new StandardMeshRuleRouter<>(url); Yaml yaml = new Yaml(new SafeConstructor()); @@ -262,7 +262,7 @@ public class MeshRuleRouterTest { } @Test - public void testRoute1() { + void testRoute1() { StandardMeshRuleRouter meshRuleRouter = new StandardMeshRuleRouter<>(url); BitList> invokers = new BitList<>(Arrays.asList(createInvoker(""), createInvoker("unknown"), createInvoker("app1"))); assertEquals(invokers, meshRuleRouter.route(invokers.clone(), null, null, false, null)); @@ -272,7 +272,7 @@ public class MeshRuleRouterTest { } @Test - public void testRoute2() { + void testRoute2() { StandardMeshRuleRouter meshRuleRouter = new StandardMeshRuleRouter<>(url); Yaml yaml = new Yaml(new SafeConstructor()); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/StandardMeshRuleRouterFactoryTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/StandardMeshRuleRouterFactoryTest.java index ddc5b11815..53a0de3ad3 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/StandardMeshRuleRouterFactoryTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/route/StandardMeshRuleRouterFactoryTest.java @@ -23,10 +23,10 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class StandardMeshRuleRouterFactoryTest { +class StandardMeshRuleRouterFactoryTest { @Test - public void getRouter() { + void getRouter() { StandardMeshRuleRouterFactory ruleRouterFactory = new StandardMeshRuleRouterFactory(); Assertions.assertTrue(ruleRouterFactory.getRouter(Object.class, URL.valueOf("")) instanceof StandardMeshRuleRouter); } diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/DestinationRuleTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/DestinationRuleTest.java index f7724874fd..b73ffdf62b 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/DestinationRuleTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/DestinationRuleTest.java @@ -33,10 +33,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -public class DestinationRuleTest { +class DestinationRuleTest { @Test - public void parserTest() { + void parserTest() { Yaml yaml = new Yaml(); DestinationRule destinationRule = yaml.loadAs(this.getClass().getClassLoader().getResourceAsStream("DestinationRuleTest.yaml"), DestinationRule.class); @@ -84,7 +84,7 @@ public class DestinationRuleTest { @Test - public void parserMultiRuleTest() { + void parserMultiRuleTest() { Yaml yaml = new Yaml(); Yaml yaml2 = new Yaml(); Iterable objectIterable = yaml.loadAll(this.getClass().getClassLoader().getResourceAsStream("DestinationRuleTest2.yaml")); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/VirtualServiceRuleTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/VirtualServiceRuleTest.java index 52647a3d6b..cca13f2e21 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/VirtualServiceRuleTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/VirtualServiceRuleTest.java @@ -31,10 +31,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; -public class VirtualServiceRuleTest { +class VirtualServiceRuleTest { @Test - public void parserTest() { + void parserTest() { Yaml yaml = new Yaml(); VirtualServiceRule virtualServiceRule = yaml.loadAs(this.getClass().getClassLoader().getResourceAsStream("VirtualServiceTest.yaml"), VirtualServiceRule.class); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/DubboMatchRequestTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/DubboMatchRequestTest.java index 7df1f5afb6..7c2e433515 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/DubboMatchRequestTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/DubboMatchRequestTest.java @@ -33,10 +33,10 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class DubboMatchRequestTest { +class DubboMatchRequestTest { @Test - public void isMatch() { + void isMatch() { DubboMatchRequest dubboMatchRequest = new DubboMatchRequest(); // methodMatch diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/BoolMatchTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/BoolMatchTest.java index 59399d7837..5b9ad498ae 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/BoolMatchTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/BoolMatchTest.java @@ -23,10 +23,10 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class BoolMatchTest { +class BoolMatchTest { @Test - public void isMatch() { + void isMatch() { BoolMatch boolMatch = new BoolMatch(); boolMatch.setExact(true); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DoubleMatchTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DoubleMatchTest.java index ed9fdc1c7e..2412e175e4 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DoubleMatchTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DoubleMatchTest.java @@ -23,10 +23,10 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class DoubleMatchTest { +class DoubleMatchTest { @Test - public void exactMatch() { + void exactMatch() { DoubleMatch doubleMatch = new DoubleMatch(); doubleMatch.setExact(10.0); @@ -35,7 +35,7 @@ public class DoubleMatchTest { } @Test - public void rangeStartMatch() { + void rangeStartMatch() { DoubleMatch doubleMatch = new DoubleMatch(); DoubleRangeMatch doubleRangeMatch = new DoubleRangeMatch(); @@ -49,7 +49,7 @@ public class DoubleMatchTest { @Test - public void rangeEndMatch() { + void rangeEndMatch() { DoubleMatch doubleMatch = new DoubleMatch(); DoubleRangeMatch doubleRangeMatch = new DoubleRangeMatch(); @@ -63,7 +63,7 @@ public class DoubleMatchTest { @Test - public void rangeStartEndMatch() { + void rangeStartEndMatch() { DoubleMatch doubleMatch = new DoubleMatch(); DoubleRangeMatch doubleRangeMatch = new DoubleRangeMatch(); @@ -83,7 +83,7 @@ public class DoubleMatchTest { } @Test - public void modMatch() { + void modMatch() { DoubleMatch doubleMatch = new DoubleMatch(); doubleMatch.setMod(2.0); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DubboAttachmentMatchTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DubboAttachmentMatchTest.java index 551cb8d7e9..66bfd3e149 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DubboAttachmentMatchTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DubboAttachmentMatchTest.java @@ -33,10 +33,10 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class DubboAttachmentMatchTest { +class DubboAttachmentMatchTest { @Test - public void dubboContextMatch() { + void dubboContextMatch() { DubboAttachmentMatch dubboAttachmentMatch = new DubboAttachmentMatch(); Map dubbocontextMatchMap = new HashMap<>(); @@ -87,7 +87,7 @@ public class DubboAttachmentMatchTest { @Test - public void tracingContextMatch() { + void tracingContextMatch() { DubboAttachmentMatch dubboAttachmentMatch = new DubboAttachmentMatch(); Map tracingContextMatchMap = new HashMap<>(); @@ -130,7 +130,7 @@ public class DubboAttachmentMatchTest { @Test - public void contextMatch() { + void contextMatch() { DubboAttachmentMatch dubboAttachmentMatch = new DubboAttachmentMatch(); Map tracingContextMatchMap = new HashMap<>(); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DubboMethodMatchTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DubboMethodMatchTest.java index a783f91fc9..267a30f662 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DubboMethodMatchTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/DubboMethodMatchTest.java @@ -28,10 +28,10 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class DubboMethodMatchTest { +class DubboMethodMatchTest { @Test - public void nameMatch() { + void nameMatch() { DubboMethodMatch dubboMethodMatch = new DubboMethodMatch(); StringMatch nameStringMatch = new StringMatch(); @@ -44,7 +44,7 @@ public class DubboMethodMatchTest { @Test - public void argcMatch() { + void argcMatch() { DubboMethodMatch dubboMethodMatch = new DubboMethodMatch(); dubboMethodMatch.setArgc(1); @@ -53,7 +53,7 @@ public class DubboMethodMatchTest { } @Test - public void argpMatch() { + void argpMatch() { DubboMethodMatch dubboMethodMatch = new DubboMethodMatch(); List argpMatch = new ArrayList<>(); @@ -76,7 +76,7 @@ public class DubboMethodMatchTest { } @Test - public void parametersMatch() { + void parametersMatch() { DubboMethodMatch dubboMethodMatch = new DubboMethodMatch(); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListBoolMatchTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListBoolMatchTest.java index c59306a5a5..7984a028ae 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListBoolMatchTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListBoolMatchTest.java @@ -26,10 +26,10 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ListBoolMatchTest { +class ListBoolMatchTest { @Test - public void isMatch() { + void isMatch() { ListBoolMatch listBoolMatch = new ListBoolMatch(); List oneof = new ArrayList<>(); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListDoubleMatchTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListDoubleMatchTest.java index d72a8c709d..1730b76bd7 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListDoubleMatchTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListDoubleMatchTest.java @@ -27,10 +27,10 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ListDoubleMatchTest { +class ListDoubleMatchTest { @Test - public void isMatch() { + void isMatch() { ListDoubleMatch listDoubleMatch = new ListDoubleMatch(); List oneof = new ArrayList<>(); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListStringMatchTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListStringMatchTest.java index d79d4f4f1c..7a7e68cf0b 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListStringMatchTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/ListStringMatchTest.java @@ -26,10 +26,10 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ListStringMatchTest { +class ListStringMatchTest { @Test - public void isMatch() { + void isMatch() { ListStringMatch listStringMatch = new ListStringMatch(); List oneof = new ArrayList<>(); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/StringMatchTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/StringMatchTest.java index 39c35a37ba..5a3b13c57a 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/StringMatchTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/rule/virtualservice/match/StringMatchTest.java @@ -23,10 +23,10 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class StringMatchTest { +class StringMatchTest { @Test - public void exactMatch() { + void exactMatch() { StringMatch stringMatch = new StringMatch(); stringMatch.setExact("qinliujie"); @@ -37,7 +37,7 @@ public class StringMatchTest { @Test - public void prefixMatch() { + void prefixMatch() { StringMatch stringMatch = new StringMatch(); stringMatch.setPrefix("org.apache.dubbo.rpc.cluster.router.mesh"); @@ -48,7 +48,7 @@ public class StringMatchTest { @Test - public void regxMatch() { + void regxMatch() { StringMatch stringMatch = new StringMatch(); stringMatch.setRegex("org.apache.dubbo.rpc.cluster.router.mesh.*"); @@ -60,7 +60,7 @@ public class StringMatchTest { @Test - public void emptyMatch() { + void emptyMatch() { StringMatch stringMatch = new StringMatch(); stringMatch.setEmpty("empty"); @@ -70,7 +70,7 @@ public class StringMatchTest { } @Test - public void noEmptyMatch() { + void noEmptyMatch() { StringMatch stringMatch = new StringMatch(); stringMatch.setNoempty("noempty"); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/util/MeshRuleDispatcherTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/util/MeshRuleDispatcherTest.java index 172d749cdd..5f548c7efd 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/util/MeshRuleDispatcherTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mesh/util/MeshRuleDispatcherTest.java @@ -29,7 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger; class MeshRuleDispatcherTest { @Test - public void post() { + void post() { MeshRuleDispatcher meshRuleDispatcher = new MeshRuleDispatcher("TestApp"); Map>> ruleMap = new HashMap<>(); @@ -107,7 +107,7 @@ class MeshRuleDispatcherTest { } @Test - public void register() { + void register() { MeshRuleDispatcher meshRuleDispatcher = new MeshRuleDispatcher("TestApp"); MeshRuleListener listener1 = new MeshRuleListener() { @@ -134,7 +134,7 @@ class MeshRuleDispatcherTest { } @Test - public void unregister() { + void unregister() { MeshRuleDispatcher meshRuleDispatcher = new MeshRuleDispatcher("TestApp"); MeshRuleListener listener1 = new MeshRuleListener() { diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mock/MockInvokersSelectorTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mock/MockInvokersSelectorTest.java index 7d6096df1b..011e871e6a 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mock/MockInvokersSelectorTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/mock/MockInvokersSelectorTest.java @@ -31,9 +31,9 @@ import java.util.List; import static org.apache.dubbo.rpc.cluster.Constants.INVOCATION_NEED_MOCK; -public class MockInvokersSelectorTest { +class MockInvokersSelectorTest { @Test - public void test() { + void test() { MockInvokersSelector selector = new MockInvokersSelector(URL.valueOf("")); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/script/ScriptStateRouterTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/script/ScriptStateRouterTest.java index 13a9a03880..2254ec51cc 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/script/ScriptStateRouterTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/script/ScriptStateRouterTest.java @@ -38,7 +38,7 @@ import java.util.List; import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY; @DisabledForJreRange(min = JRE.JAVA_16) -public class ScriptStateRouterTest { +class ScriptStateRouterTest { private URL SCRIPT_URL = URL.valueOf("script://javascript?type=javascript"); @@ -55,7 +55,7 @@ public class ScriptStateRouterTest { } @Test - public void testRouteReturnAll() { + void testRouteReturnAll() { StateRouter router = new ScriptStateRouterFactory().getRouter(String.class, getRouteUrl("function route(op1,op2){return op1} route(invokers)")); List> originInvokers = new ArrayList>(); originInvokers.add(new MockInvoker()); @@ -68,7 +68,7 @@ public class ScriptStateRouterTest { } @Test - public void testRoutePickInvokers() { + void testRoutePickInvokers() { String rule = "var result = new java.util.ArrayList(invokers.size());" + "for (i=0;i> originInvokers = new ArrayList>(); MockInvoker invoker1 = new MockInvoker(URL.valueOf("dubbo://10.134.108.1:20880/com.dubbo.HelloService")); MockInvoker invoker2 = new MockInvoker(URL.valueOf("dubbo://10.134.108.2:20880/com.dubbo.HelloService")); @@ -125,7 +125,7 @@ public class ScriptStateRouterTest { } @Test - public void testRoute_throwException() { + void testRoute_throwException() { List> originInvokers = new ArrayList>(); MockInvoker invoker1 = new MockInvoker(URL.valueOf("dubbo://10.134.108.1:20880/com.dubbo.HelloService")); MockInvoker invoker2 = new MockInvoker(URL.valueOf("dubbo://10.134.108.2:20880/com.dubbo.HelloService")); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/state/BitListTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/state/BitListTest.java index c6e0117354..54bc765fb2 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/state/BitListTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/state/BitListTest.java @@ -18,6 +18,7 @@ package org.apache.dubbo.rpc.cluster.router.state; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.provider.ValueSource; import java.util.Arrays; import java.util.Collections; @@ -26,9 +27,9 @@ import java.util.LinkedList; import java.util.List; import java.util.ListIterator; -public class BitListTest { +class BitListTest { @Test - public void test() { + void test() { List list = Arrays.asList("A", "B", "C"); BitList bitList = new BitList<>(list); Assertions.assertEquals(bitList.getOriginList(), list); @@ -57,12 +58,12 @@ public class BitListTest { Object[] newObjects = new Object[1]; Object[] copiedList = bitList.toArray(newObjects); - Assertions.assertEquals(copiedList.length, 3); + Assertions.assertEquals(3, copiedList.length); Assertions.assertArrayEquals(copiedList, list.toArray()); newObjects = new Object[10]; copiedList = bitList.toArray(newObjects); - Assertions.assertEquals(copiedList.length, 10); + Assertions.assertEquals(10, copiedList.length); Assertions.assertEquals("A", copiedList[0]); Assertions.assertEquals("B", copiedList[1]); Assertions.assertEquals("C", copiedList[2]); @@ -78,7 +79,7 @@ public class BitListTest { } @Test - public void testIntersect() { + void testIntersect() { List aList = Arrays.asList("A", "B", "C"); List bList = Arrays.asList("A", "B"); List totalList = Arrays.asList("A", "B", "C"); @@ -87,20 +88,20 @@ public class BitListTest { BitList bBitList = new BitList<>(bList); BitList intersectBitList = aBitList.and(bBitList); - Assertions.assertEquals(intersectBitList.size(), 2); - Assertions.assertEquals(intersectBitList.get(0), totalList.get(0)); - Assertions.assertEquals(intersectBitList.get(1), totalList.get(1)); + Assertions.assertEquals(2, intersectBitList.size()); + Assertions.assertEquals(totalList.get(0), intersectBitList.get(0)); + Assertions.assertEquals(totalList.get(1), intersectBitList.get(1)); aBitList.add("D"); intersectBitList = aBitList.and(bBitList); - Assertions.assertEquals(intersectBitList.size(), 3); - Assertions.assertEquals(intersectBitList.get(0), totalList.get(0)); - Assertions.assertEquals(intersectBitList.get(1), totalList.get(1)); + Assertions.assertEquals(3, intersectBitList.size()); + Assertions.assertEquals(totalList.get(0), intersectBitList.get(0)); + Assertions.assertEquals(totalList.get(1), intersectBitList.get(1)); Assertions.assertEquals("D", intersectBitList.get(2)); } @Test - public void testIsEmpty() { + void testIsEmpty() { List list = Arrays.asList("A", "B", "C"); BitList bitList = new BitList<>(list); bitList.add("D"); @@ -113,7 +114,7 @@ public class BitListTest { } @Test - public void testAdd() { + void testAdd() { List list = Arrays.asList("A", "B", "C"); BitList bitList = new BitList<>(list); @@ -138,7 +139,7 @@ public class BitListTest { } @Test - public void testAddAll() { + void testAddAll() { List list = Arrays.asList("A", "B", "C"); BitList bitList1 = new BitList<>(list); BitList bitList2 = new BitList<>(list); @@ -158,7 +159,7 @@ public class BitListTest { } @Test - public void testGet() { + void testGet() { List list = Arrays.asList("A", "B", "C"); BitList bitList = new BitList<>(list); @@ -178,7 +179,7 @@ public class BitListTest { } @Test - public void testRemove() { + void testRemove() { List list = Arrays.asList("A", "B", "C"); BitList bitList = new BitList<>(list); @@ -210,7 +211,7 @@ public class BitListTest { } @Test - public void testRemoveIndex() { + void testRemoveIndex() { List list = Arrays.asList("A", "B", "C"); BitList bitList = new BitList<>(list); @@ -240,7 +241,7 @@ public class BitListTest { } @Test - public void testRetain() { + void testRetain() { List list = Arrays.asList("A", "B", "C"); BitList bitList = new BitList<>(list); @@ -264,7 +265,7 @@ public class BitListTest { } @Test - public void testIndex() { + void testIndex() { List list = Arrays.asList("A", "B", "A"); BitList bitList = new BitList<>(list); @@ -286,7 +287,7 @@ public class BitListTest { } @Test - public void testSubList() { + void testSubList() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); bitList.addAll(Arrays.asList("F", "G", "H", "I")); @@ -333,7 +334,7 @@ public class BitListTest { } @Test - public void testListIterator1() { + void testListIterator1() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); @@ -352,7 +353,8 @@ public class BitListTest { } @Test - public void testListIterator2() { + @ValueSource(ints = {2, }) + void testListIterator2() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); bitList.addAll(Arrays.asList("F", "G", "H", "I")); @@ -373,7 +375,7 @@ public class BitListTest { } @Test - public void testListIterator3() { + void testListIterator3() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); bitList.addAll(Arrays.asList("F", "G", "H", "I")); @@ -394,7 +396,7 @@ public class BitListTest { } @Test - public void testListIterator4() { + void testListIterator4() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); bitList.addAll(Arrays.asList("F", "G", "H", "I")); @@ -415,7 +417,7 @@ public class BitListTest { } @Test - public void testListIterator5() { + void testListIterator5() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); bitList.addAll(Arrays.asList("F", "G", "H", "I")); @@ -445,7 +447,7 @@ public class BitListTest { } @Test - public void testListIterator6() { + void testListIterator6() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); bitList.addAll(Arrays.asList("F", "G", "H", "I")); @@ -474,7 +476,7 @@ public class BitListTest { } @Test - public void testListIterator7() { + void testListIterator7() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); bitList.addAll(Arrays.asList("F", "G", "H", "I")); @@ -503,7 +505,7 @@ public class BitListTest { } @Test - public void testListIterator8() { + void testListIterator8() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); bitList.addAll(Arrays.asList("F", "G", "H", "I")); @@ -532,7 +534,7 @@ public class BitListTest { } @Test - public void testClone1() { + void testClone1() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); @@ -553,7 +555,7 @@ public class BitListTest { } @Test - public void testClone2() { + void testClone2() { List list = Arrays.asList("A", "B", "C", "D", "E"); BitList bitList = new BitList<>(list); bitList.addAll(Arrays.asList("F", "G")); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouterTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouterTest.java index 0604240166..09258d4055 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouterTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouterTest.java @@ -46,7 +46,7 @@ import java.util.Set; import static org.apache.dubbo.common.constants.CommonConstants.TAG_KEY; import static org.mockito.Mockito.when; -public class TagStateRouterTest { +class TagStateRouterTest { private URL url; private ModuleModel originModel; private ModuleModel moduleModel; @@ -71,7 +71,7 @@ public class TagStateRouterTest { } @Test - public void testTagRoutePickInvokers() { + void testTagRoutePickInvokers() { StateRouter router = new TagStateRouterFactory().getRouter(TagRouterRule.class, url); List> originInvokers = new ArrayList<>(); @@ -103,7 +103,7 @@ public class TagStateRouterTest { * */ @Test - public void tagRouterRuleParseTest() { + void tagRouterRuleParseTest() { String tagRouterRuleConfig = "---\n" + "force: false\n" + "runtime: true\n" + diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java index 1962a6e2bc..74966bb338 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java @@ -69,7 +69,7 @@ import static org.mockito.Mockito.when; * AbstractClusterInvokerTest */ @SuppressWarnings("rawtypes") -public class AbstractClusterInvokerTest { +class AbstractClusterInvokerTest { List> invokers = new ArrayList>(); List> selectedInvokers = new ArrayList>(); AbstractClusterInvoker cluster; @@ -165,7 +165,7 @@ public class AbstractClusterInvokerTest { @Disabled("RpcContext attachments will be set to Invocation twice, first in ConsumerContextFilter, second AbstractInvoker") @Test - public void testBindingAttachment() { + void testBindingAttachment() { final String attachKey = "attach"; final String attachValue = "value"; @@ -191,7 +191,7 @@ public class AbstractClusterInvokerTest { } @Test - public void testSelect_Invokersize0() throws Exception { + void testSelect_Invokersize0() throws Exception { LoadBalance l = cluster.initLoadBalance(invokers, invocation); Assertions.assertNotNull(l,"cluster.initLoadBalance returns null!"); { @@ -207,7 +207,7 @@ public class AbstractClusterInvokerTest { } @Test - public void testSelect_Invokersize1() throws Exception { + void testSelect_Invokersize1() throws Exception { invokers.clear(); invokers.add(invoker1); LoadBalance l = cluster.initLoadBalance(invokers, invocation); @@ -217,7 +217,7 @@ public class AbstractClusterInvokerTest { } @Test - public void testSelect_Invokersize2AndselectNotNull() throws Exception { + void testSelect_Invokersize2AndselectNotNull() throws Exception { invokers.clear(); invokers.add(invoker2); invokers.add(invoker4); @@ -238,14 +238,14 @@ public class AbstractClusterInvokerTest { } @Test - public void testSelect_multiInvokers() throws Exception { + void testSelect_multiInvokers() throws Exception { testSelect_multiInvokers(RoundRobinLoadBalance.NAME); testSelect_multiInvokers(LeastActiveLoadBalance.NAME); testSelect_multiInvokers(RandomLoadBalance.NAME); } @Test - public void testCloseAvailablecheck() { + void testCloseAvailablecheck() { LoadBalance lb = mock(LoadBalance.class); Map queryMap = (Map )url.getAttribute(REFER_KEY); URL tmpUrl = turnRegistryUrlToConsumerUrl(url, queryMap); @@ -273,7 +273,7 @@ public class AbstractClusterInvokerTest { } @Test - public void testDonotSelectAgainAndNoCheckAvailable() { + void testDonotSelectAgainAndNoCheckAvailable() { LoadBalance lb = ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtension(RoundRobinLoadBalance.NAME); initlistsize5(); @@ -332,7 +332,7 @@ public class AbstractClusterInvokerTest { } @Test - public void testSelectAgainAndCheckAvailable() { + void testSelectAgainAndCheckAvailable() { LoadBalance lb = ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtension(RoundRobinLoadBalance.NAME); initlistsize5(); @@ -457,7 +457,7 @@ public class AbstractClusterInvokerTest { * Test balance. */ @Test - public void testSelectBalance() { + void testSelectBalance() { LoadBalance lb = ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtension(RoundRobinLoadBalance.NAME); initlistsize5(); @@ -500,7 +500,7 @@ public class AbstractClusterInvokerTest { } @Test - public void testTimeoutExceptionCode() { + void testTimeoutExceptionCode() { List> invokers = new ArrayList>(); invokers.add(new Invoker() { @@ -529,22 +529,25 @@ public class AbstractClusterInvokerTest { }); Directory directory = new StaticDirectory(invokers); FailoverClusterInvoker failoverClusterInvoker = new FailoverClusterInvoker(directory); + RpcInvocation invocation = new RpcInvocation("sayHello", DemoService.class.getName(), "", new Class[0], new Object[0]); try { - failoverClusterInvoker.invoke(new RpcInvocation("sayHello", DemoService.class.getName(), "", new Class[0], new Object[0])); + failoverClusterInvoker.invoke(invocation); Assertions.fail(); } catch (RpcException e) { Assertions.assertEquals(RpcException.TIMEOUT_EXCEPTION, e.getCode()); } ForkingClusterInvoker forkingClusterInvoker = new ForkingClusterInvoker(directory); + invocation = new RpcInvocation("sayHello", DemoService.class.getName(), "", new Class[0], new Object[0]); try { - forkingClusterInvoker.invoke(new RpcInvocation("sayHello", DemoService.class.getName(), "", new Class[0], new Object[0])); + forkingClusterInvoker.invoke(invocation); Assertions.fail(); } catch (RpcException e) { Assertions.assertEquals(RpcException.TIMEOUT_EXCEPTION, e.getCode()); } FailfastClusterInvoker failfastClusterInvoker = new FailfastClusterInvoker(directory); + invocation = new RpcInvocation("sayHello", DemoService.class.getName(), "", new Class[0], new Object[0]); try { - failfastClusterInvoker.invoke(new RpcInvocation("sayHello", DemoService.class.getName(), "", new Class[0], new Object[0])); + failfastClusterInvoker.invoke(invocation); Assertions.fail(); } catch (RpcException e) { Assertions.assertEquals(RpcException.TIMEOUT_EXCEPTION, e.getCode()); @@ -555,7 +558,7 @@ public class AbstractClusterInvokerTest { * Test mock invoker selector works as expected */ @Test - public void testMockedInvokerSelect() { + void testMockedInvokerSelect() { initlistsize5(); invokers.add(mockedInvoker1); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AvailableClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AvailableClusterInvokerTest.java index 6fe82473fe..4218bd72d8 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AvailableClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AvailableClusterInvokerTest.java @@ -40,7 +40,7 @@ import static org.mockito.Mockito.mock; /** * Test for AvailableClusterInvoker */ -public class AvailableClusterInvokerTest { +class AvailableClusterInvokerTest { private final URL url = URL.valueOf("test://test:80/test"); private final Invoker invoker1 = mock(Invoker.class); @@ -87,7 +87,7 @@ public class AvailableClusterInvokerTest { } @Test - public void testInvokeNoException() { + void testInvokeNoException() { resetInvokerToNoException(); @@ -97,7 +97,7 @@ public class AvailableClusterInvokerTest { } @Test - public void testInvokeWithException() { + void testInvokeWithException() { // remove invokers for test exception dic.list(invocation).removeAll(invokers); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/BroadCastClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/BroadCastClusterInvokerTest.java index b25e94f228..9cba72c075 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/BroadCastClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/BroadCastClusterInvokerTest.java @@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock; /** * @see BroadcastClusterInvoker */ -public class BroadCastClusterInvokerTest { +class BroadCastClusterInvokerTest { private URL url; private Directory dic; private RpcInvocation invocation; @@ -74,7 +74,7 @@ public class BroadCastClusterInvokerTest { @Test - public void testNormal() { + void testNormal() { given(dic.list(invocation)).willReturn(Arrays.asList(invoker1, invoker2, invoker3, invoker4)); // Every invoker will be called clusterInvoker.invoke(invocation); @@ -85,7 +85,7 @@ public class BroadCastClusterInvokerTest { } @Test - public void testEx() { + void testEx() { given(dic.list(invocation)).willReturn(Arrays.asList(invoker1, invoker2, invoker3, invoker4)); invoker1.invokeThrowEx(); assertThrows(RpcException.class, () -> { @@ -99,7 +99,7 @@ public class BroadCastClusterInvokerTest { } @Test - public void testFailPercent() { + void testFailPercent() { given(dic.list(invocation)).willReturn(Arrays.asList(invoker1, invoker2, invoker3, invoker4)); // We set the failure percentage to 75, which means that when the number of call failures is 4*(75/100) = 3, // an exception will be thrown directly and subsequent invokers will not be called. diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ClusterUtilsTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ClusterUtilsTest.java index 69fd0b58e9..b8a5838c79 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ClusterUtilsTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ClusterUtilsTest.java @@ -44,7 +44,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.URL_MERGE_PROCES import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY; -public class ClusterUtilsTest { +class ClusterUtilsTest { private ClusterUtils clusterUtils; @@ -55,7 +55,7 @@ public class ClusterUtilsTest { } @Test - public void testMergeUrl() throws Exception { + void testMergeUrl() throws Exception { URL providerURL = URL.valueOf("dubbo://localhost:55555"); providerURL = providerURL.setPath("path") .setUsername("username") @@ -136,7 +136,7 @@ public class ClusterUtilsTest { } @Test - public void testMergeLocalParams() { + void testMergeLocalParams() { // Verify default ProviderURLMergeProcessor URL consumerURL = new URLBuilder(DUBBO_PROTOCOL, "localhost", 55555) diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ConnectivityValidationTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ConnectivityValidationTest.java index 41c96b5cc0..0ccb77b8d5 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ConnectivityValidationTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ConnectivityValidationTest.java @@ -46,7 +46,7 @@ import java.util.concurrent.ThreadLocalRandom; import static org.mockito.Mockito.when; @SuppressWarnings("all") -public class ConnectivityValidationTest { +class ConnectivityValidationTest { private Invoker invoker1; private Invoker invoker2; private Invoker invoker3; @@ -134,7 +134,7 @@ public class ConnectivityValidationTest { } @Test - public void testBasic() throws InterruptedException { + void testBasic() throws InterruptedException { Invocation invocation = new RpcInvocation(); LoadBalance loadBalance = new RandomLoadBalance(); @@ -181,7 +181,7 @@ public class ConnectivityValidationTest { } @Test - public void testRetry() throws InterruptedException { + void testRetry() throws InterruptedException { Invocation invocation = new RpcInvocation(); LoadBalance loadBalance = new RandomLoadBalance(); @@ -204,7 +204,7 @@ public class ConnectivityValidationTest { } @Test - public void testRandomSelect() throws InterruptedException { + void testRandomSelect() throws InterruptedException { Invocation invocation = new RpcInvocation(); LoadBalance loadBalance = new RandomLoadBalance(); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailSafeClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailSafeClusterInvokerTest.java index b8fb6c7421..8887154a6c 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailSafeClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailSafeClusterInvokerTest.java @@ -42,7 +42,7 @@ import static org.mockito.Mockito.mock; * */ @SuppressWarnings("unchecked") -public class FailSafeClusterInvokerTest { +class FailSafeClusterInvokerTest { List> invokers = new ArrayList>(); URL url = URL.valueOf("test://test:11/test"); Invoker invoker = mock(Invoker.class); @@ -82,7 +82,7 @@ public class FailSafeClusterInvokerTest { //TODO assert error log @Test - public void testInvokeExceptoin() { + void testInvokeExceptoin() { resetInvokerToException(); FailsafeClusterInvoker invoker = new FailsafeClusterInvoker(dic); invoker.invoke(invocation); @@ -90,7 +90,7 @@ public class FailSafeClusterInvokerTest { } @Test - public void testInvokeNoExceptoin() { + void testInvokeNoExceptoin() { resetInvokerToNoException(); @@ -100,7 +100,7 @@ public class FailSafeClusterInvokerTest { } @Test - public void testNoInvoke() { + void testNoInvoke() { dic = mock(Directory.class); given(dic.getUrl()).willReturn(url); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvokerTest.java index 7711861ec2..d7e48afef6 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvokerTest.java @@ -55,7 +55,7 @@ import static org.mockito.Mockito.mock; * add annotation @TestMethodOrder, the testARetryFailed Method must to first execution */ @TestMethodOrder(MethodOrderer.OrderAnnotation.class) -public class FailbackClusterInvokerTest { +class FailbackClusterInvokerTest { List> invokers = new ArrayList<>(); URL url = URL.valueOf("test://test:11/test?retries=2&failbacktasks=2"); @@ -104,7 +104,7 @@ public class FailbackClusterInvokerTest { } @Test - public void testInvokeWithIllegalRetriesParam() { + void testInvokeWithIllegalRetriesParam() { URL url = URL.valueOf("test://test:11/test?retries=-1&failbacktasks=2"); Directory dic = mock(Directory.class); given(dic.getUrl()).willReturn(url); @@ -117,7 +117,7 @@ public class FailbackClusterInvokerTest { } @Test - public void testInvokeWithIllegalFailbacktasksParam() { + void testInvokeWithIllegalFailbacktasksParam() { URL url = URL.valueOf("test://test:11/test?retries=2&failbacktasks=-1"); Directory dic = mock(Directory.class); given(dic.getUrl()).willReturn(url); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailfastClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailfastClusterInvokerTest.java index ae6f3c816e..f1f3412138 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailfastClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailfastClusterInvokerTest.java @@ -43,7 +43,7 @@ import static org.mockito.Mockito.mock; * FailfastClusterInvokerTest */ @SuppressWarnings("unchecked") -public class FailfastClusterInvokerTest { +class FailfastClusterInvokerTest { List> invokers = new ArrayList<>(); URL url = URL.valueOf("test://test:11/test"); Invoker invoker1 = mock(Invoker.class); @@ -83,7 +83,7 @@ public class FailfastClusterInvokerTest { } @Test - public void testInvokeException() { + void testInvokeException() { Assertions.assertThrows(RpcException.class, () -> { resetInvoker1ToException(); FailfastClusterInvoker invoker = new FailfastClusterInvoker<>(dic); @@ -93,7 +93,7 @@ public class FailfastClusterInvokerTest { } @Test - public void testInvokeBizException() { + void testInvokeBizException() { given(invoker1.invoke(invocation)).willThrow(new RpcException(RpcException.BIZ_EXCEPTION)); given(invoker1.getUrl()).willReturn(url); given(invoker1.getInterface()).willReturn(FailfastClusterInvokerTest.class); @@ -109,7 +109,7 @@ public class FailfastClusterInvokerTest { } @Test - public void testInvokeNoException() { + void testInvokeNoException() { resetInvoker1ToNoException(); @@ -119,7 +119,7 @@ public class FailfastClusterInvokerTest { } @Test - public void testNoInvoke() { + void testNoInvoke() { dic = mock(Directory.class); given(dic.getUrl()).willReturn(url); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvokerTest.java index 6d906fae94..c9b0e99178 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvokerTest.java @@ -49,7 +49,7 @@ import static org.mockito.Mockito.mock; * FailoverClusterInvokerTest */ @SuppressWarnings("unchecked") -public class FailoverClusterInvokerTest { +class FailoverClusterInvokerTest { private final int retries = 5; private final URL url = URL.valueOf("test://test:11/test?retries=" + retries); private final Invoker invoker1 = mock(Invoker.class); @@ -80,7 +80,7 @@ public class FailoverClusterInvokerTest { @Test - public void testInvokeWithRuntimeException() { + void testInvokeWithRuntimeException() { given(invoker1.invoke(invocation)).willThrow(new RuntimeException()); given(invoker1.isAvailable()).willReturn(true); given(invoker1.getUrl()).willReturn(url); @@ -102,7 +102,7 @@ public class FailoverClusterInvokerTest { } @Test - public void testInvokeWithRPCException() { + void testInvokeWithRPCException() { given(invoker1.invoke(invocation)).willThrow(new RpcException()); given(invoker1.isAvailable()).willReturn(true); given(invoker1.getUrl()).willReturn(url); @@ -121,7 +121,7 @@ public class FailoverClusterInvokerTest { } @Test - public void testInvoke_retryTimes() { + void testInvoke_retryTimes() { given(invoker1.invoke(invocation)).willThrow(new RpcException(RpcException.TIMEOUT_EXCEPTION)); given(invoker1.isAvailable()).willReturn(false); given(invoker1.getUrl()).willReturn(url); @@ -144,7 +144,7 @@ public class FailoverClusterInvokerTest { } @Test - public void testInvoke_retryTimes2() { + void testInvoke_retryTimes2() { int finalRetries = 1; given(invoker1.invoke(invocation)).willThrow(new RpcException(RpcException.TIMEOUT_EXCEPTION)); given(invoker1.isAvailable()).willReturn(false); @@ -171,7 +171,7 @@ public class FailoverClusterInvokerTest { } @Test - public void testInvoke_retryTimes_withBizException() { + void testInvoke_retryTimes_withBizException() { given(invoker1.invoke(invocation)).willThrow(new RpcException(RpcException.BIZ_EXCEPTION)); given(invoker1.isAvailable()).willReturn(false); given(invoker1.getUrl()).willReturn(url); @@ -193,7 +193,7 @@ public class FailoverClusterInvokerTest { } @Test - public void testInvoke_without_retry() { + void testInvoke_without_retry() { int withoutRetry = 0; final URL url = URL.valueOf("test://localhost/" + Demo.class.getName() + "?loadbalance=roundrobin&retries=" + withoutRetry); RpcException exception = new RpcException(RpcException.TIMEOUT_EXCEPTION); @@ -220,7 +220,7 @@ public class FailoverClusterInvokerTest { } @Test - public void testInvoke_when_retry_illegal() { + void testInvoke_when_retry_illegal() { int illegalRetry = -1; final URL url = URL.valueOf("test://localhost/" + Demo.class.getName() + "?loadbalance=roundrobin&retries=" + illegalRetry); RpcException exception = new RpcException(RpcException.TIMEOUT_EXCEPTION); @@ -247,7 +247,7 @@ public class FailoverClusterInvokerTest { } @Test - public void testNoInvoke() { + void testNoInvoke() { dic = mock(Directory.class); given(dic.getUrl()).willReturn(url); @@ -273,7 +273,7 @@ public class FailoverClusterInvokerTest { * then we should reselect from the latest invokers before retry. */ @Test - public void testInvokerDestroyAndReList() { + void testInvokerDestroyAndReList() { final URL url = URL.valueOf("test://localhost/" + Demo.class.getName() + "?loadbalance=roundrobin&retries=" + retries); RpcException exception = new RpcException(RpcException.TIMEOUT_EXCEPTION); MockInvoker invoker1 = new MockInvoker<>(Demo.class, url); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvokerTest.java index fa5b714aba..4fe7400a33 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvokerTest.java @@ -41,7 +41,7 @@ import static org.mockito.Mockito.mock; * ForkingClusterInvokerTest */ @SuppressWarnings("unchecked") -public class ForkingClusterInvokerTest { +class ForkingClusterInvokerTest { private List> invokers = new ArrayList<>(); private URL url = URL.valueOf("test://test:11/test?forks=2"); @@ -105,7 +105,7 @@ public class ForkingClusterInvokerTest { } @Test - public void testInvokeException() { + void testInvokeException() { resetInvokerToException(); ForkingClusterInvoker invoker = new ForkingClusterInvoker<>(dic); @@ -119,7 +119,7 @@ public class ForkingClusterInvokerTest { } @Test - public void testClearRpcContext() { + void testClearRpcContext() { resetInvokerToException(); ForkingClusterInvoker invoker = new ForkingClusterInvoker<>(dic); @@ -142,7 +142,7 @@ public class ForkingClusterInvokerTest { } @Test - public void testInvokeNoException() { + void testInvokeNoException() { resetInvokerToNoException(); @@ -152,7 +152,7 @@ public class ForkingClusterInvokerTest { } @Test - public void testInvokeWithIllegalForksParam() { + void testInvokeWithIllegalForksParam() { URL url = URL.valueOf("test://test:11/test?forks=-1"); given(dic.getUrl()).willReturn(url); given(dic.getConsumerUrl()).willReturn(url); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/Menu.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/Menu.java index 5f2b56143f..cfd5a55bc6 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/Menu.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/Menu.java @@ -22,7 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class Menu { +class Menu { private Map> menus = new HashMap>(); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java index b95d0ef1a5..eab0b6c44c 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java @@ -49,7 +49,7 @@ import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -public class MergeableClusterInvokerTest { +class MergeableClusterInvokerTest { private Directory directory = mock(Directory.class); private Invoker firstInvoker = mock(Invoker.class); @@ -102,7 +102,7 @@ public class MergeableClusterInvokerTest { } @Test - public void testGetMenuSuccessfully() { + void testGetMenuSuccessfully() { // setup url = url.addParameter(MERGER_KEY, ".merge"); @@ -173,7 +173,7 @@ public class MergeableClusterInvokerTest { } @Test - public void testAddMenu() { + void testAddMenu() { String menu = "first"; List menuItems = new ArrayList() { @@ -219,7 +219,7 @@ public class MergeableClusterInvokerTest { } @Test - public void testAddMenu1() { + void testAddMenu1() { // setup url = url.addParameter(MERGER_KEY, ".merge"); @@ -284,7 +284,7 @@ public class MergeableClusterInvokerTest { } @Test - public void testInvokerToNoInvokerAvailableException() { + void testInvokerToNoInvokerAvailableException() { String menu = "first"; List menuItems = new ArrayList() { { @@ -339,7 +339,7 @@ public class MergeableClusterInvokerTest { * test when network exception */ @Test - public void testInvokerToException() { + void testInvokerToException() { String menu = "first"; List menuItems = new ArrayList() { { @@ -391,7 +391,7 @@ public class MergeableClusterInvokerTest { } @Test - public void testGetMenuResultHasException() { + void testGetMenuResultHasException() { // setup url = url.addParameter(MERGER_KEY, ".merge"); @@ -437,7 +437,7 @@ public class MergeableClusterInvokerTest { } @Test - public void testGetMenuWithMergerDefault() { + void testGetMenuWithMergerDefault() { // setup url = url.addParameter(MERGER_KEY, "default"); @@ -501,7 +501,7 @@ public class MergeableClusterInvokerTest { } @Test - public void testDestroy() { + void testDestroy() { given(invocation.getMethodName()).willReturn("getMenu"); given(invocation.getParameterTypes()).willReturn(new Class[]{}); given(invocation.getArguments()).willReturn(new Object[]{}); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/merger/DefaultProviderURLMergeProcessorTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/merger/DefaultProviderURLMergeProcessorTest.java index 801b4cb043..7b2a9abee3 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/merger/DefaultProviderURLMergeProcessorTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/merger/DefaultProviderURLMergeProcessorTest.java @@ -47,7 +47,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY; import static org.apache.dubbo.common.constants.CommonConstants.TIMESTAMP_KEY; import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY; -public class DefaultProviderURLMergeProcessorTest { +class DefaultProviderURLMergeProcessorTest { private ProviderURLMergeProcessor providerURLMergeProcessor; @@ -57,7 +57,7 @@ public class DefaultProviderURLMergeProcessorTest { } @Test - public void testMergeUrl() throws Exception { + void testMergeUrl() throws Exception { URL providerURL = URL.valueOf("dubbo://localhost:55555"); providerURL = providerURL.setPath("path") .setUsername("username") @@ -124,7 +124,7 @@ public class DefaultProviderURLMergeProcessorTest { } @Test - public void testUseProviderParams() { + void testUseProviderParams() { // present in both local and remote, but uses remote value. URL localURL = URL.valueOf("dubbo://localhost:20880/DemoService?version=local&group=local&dubbo=local&release=local" + "&methods=local&tag=local×tamp=local"); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvokerTest.java index 848fbf2aaa..263c7fd888 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareClusterInvokerTest.java @@ -37,7 +37,7 @@ import static org.apache.dubbo.common.constants.RegistryConstants.ZONE_KEY; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -public class ZoneAwareClusterInvokerTest { +class ZoneAwareClusterInvokerTest { private Directory directory = mock(Directory.class); private ClusterInvoker firstInvoker = mock(ClusterInvoker.class); @@ -54,7 +54,7 @@ public class ZoneAwareClusterInvokerTest { String unexpectedValue = "unexpected"; @Test - public void testPreferredStrategy() { + void testPreferredStrategy() { given(invocation.getParameterTypes()).willReturn(new Class[]{}); given(invocation.getArguments()).willReturn(new Object[]{}); given(invocation.getObjectAttachments()).willReturn(new HashMap<>()); @@ -95,7 +95,7 @@ public class ZoneAwareClusterInvokerTest { } @Test - public void testRegistryZoneStrategy() { + void testRegistryZoneStrategy() { String zoneKey = "zone"; given(invocation.getParameterTypes()).willReturn(new Class[]{}); @@ -139,7 +139,7 @@ public class ZoneAwareClusterInvokerTest { } @Test - public void testRegistryZoneForceStrategy() { + void testRegistryZoneForceStrategy() { String zoneKey = "zone"; given(invocation.getParameterTypes()).willReturn(new Class[]{}); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/AbstractClusterTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/AbstractClusterTest.java index 6245b71cf4..395620923a 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/AbstractClusterTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/AbstractClusterTest.java @@ -42,10 +42,10 @@ import static org.apache.dubbo.common.constants.CommonConstants.REFERENCE_FILTER import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class AbstractClusterTest { +class AbstractClusterTest { @Test - public void testBuildClusterInvokerChain() { + void testBuildClusterInvokerChain() { Map parameters = new HashMap<>(); parameters.put(INTERFACE_KEY, DemoService.class.getName()); diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java index 6b5745e706..62646cb201 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java @@ -43,7 +43,7 @@ import java.util.concurrent.ExecutionException; import static org.apache.dubbo.common.constants.CommonConstants.PATH_KEY; import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY; -public class MockClusterInvokerTest { +class MockClusterInvokerTest { List> invokers = new ArrayList>(); @@ -56,7 +56,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerInvoke_normal() { + void testMockInvokerInvoke_normal() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()); url = url.addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -86,7 +86,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerInvoke_failmock() { + void testMockInvokerInvoke_failmock() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -126,7 +126,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: force-mock */ @Test - public void testMockInvokerInvoke_forcemock() { + void testMockInvokerInvoke_forcemock() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -165,7 +165,7 @@ public class MockClusterInvokerTest { } @Test - public void testMockInvokerInvoke_forcemock_defaultreturn() { + void testMockInvokerInvoke_forcemock_defaultreturn() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -190,7 +190,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerFromOverride_Invoke_Fock_someMethods() { + void testMockInvokerFromOverride_Invoke_Fock_someMethods() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -226,7 +226,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerFromOverride_Invoke_Fock_WithOutDefault() { + void testMockInvokerFromOverride_Invoke_Fock_WithOutDefault() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -261,7 +261,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerFromOverride_Invoke_Fock_WithDefault() { + void testMockInvokerFromOverride_Invoke_Fock_WithDefault() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -299,7 +299,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerFromOverride_Invoke_Fock_WithFailDefault() { + void testMockInvokerFromOverride_Invoke_Fock_WithFailDefault() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -337,7 +337,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerFromOverride_Invoke_Fock_WithForceDefault() { + void testMockInvokerFromOverride_Invoke_Fock_WithForceDefault() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -375,7 +375,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerFromOverride_Invoke_Fock_Default() { + void testMockInvokerFromOverride_Invoke_Fock_Default() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -405,7 +405,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerFromOverride_Invoke_checkCompatible_return() { + void testMockInvokerFromOverride_Invoke_checkCompatible_return() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -433,7 +433,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock() { + void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -452,7 +452,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock2() { + void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock2() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() + "&" + "mock=fail")) @@ -469,7 +469,7 @@ public class MockClusterInvokerTest { * Test if mock policy works fine: fail-mock */ @Test - public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock3() { + void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock3() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() + "&" + "mock=force")); @@ -482,7 +482,7 @@ public class MockClusterInvokerTest { } @Test - public void testMockInvokerFromOverride_Invoke_check_String() { + void testMockInvokerFromOverride_Invoke_check_String() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter("getSomething.mock", "force:return 1688") .addParameter(REFER_KEY, @@ -499,7 +499,7 @@ public class MockClusterInvokerTest { } @Test - public void testMockInvokerFromOverride_Invoke_check_int() { + void testMockInvokerFromOverride_Invoke_check_int() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -515,7 +515,7 @@ public class MockClusterInvokerTest { } @Test - public void testMockInvokerFromOverride_Invoke_check_boolean() { + void testMockInvokerFromOverride_Invoke_check_boolean() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -531,7 +531,7 @@ public class MockClusterInvokerTest { } @Test - public void testMockInvokerFromOverride_Invoke_check_Boolean() { + void testMockInvokerFromOverride_Invoke_check_Boolean() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -547,7 +547,7 @@ public class MockClusterInvokerTest { @SuppressWarnings("unchecked") @Test - public void testMockInvokerFromOverride_Invoke_check_ListString_empty() { + void testMockInvokerFromOverride_Invoke_check_ListString_empty() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -563,7 +563,7 @@ public class MockClusterInvokerTest { @SuppressWarnings("unchecked") @Test - public void testMockInvokerFromOverride_Invoke_check_ListString() { + void testMockInvokerFromOverride_Invoke_check_ListString() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -581,7 +581,7 @@ public class MockClusterInvokerTest { @SuppressWarnings("unchecked") @Test - public void testMockInvokerFromOverride_Invoke_check_ListPojo_empty() { + void testMockInvokerFromOverride_Invoke_check_ListPojo_empty() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -595,7 +595,7 @@ public class MockClusterInvokerTest { Assertions.assertEquals(0, ((List) ret.getValue()).size()); } @Test - public void testMockInvokerFromOverride_Invoke_check_ListPojoAsync() throws ExecutionException, InterruptedException { + void testMockInvokerFromOverride_Invoke_check_ListPojoAsync() throws ExecutionException, InterruptedException { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -620,7 +620,7 @@ public class MockClusterInvokerTest { @SuppressWarnings("unchecked") @Test - public void testMockInvokerFromOverride_Invoke_check_ListPojo() { + void testMockInvokerFromOverride_Invoke_check_ListPojo() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -638,7 +638,7 @@ public class MockClusterInvokerTest { } @Test - public void testMockInvokerFromOverride_Invoke_check_ListPojo_error() { + void testMockInvokerFromOverride_Invoke_check_ListPojo_error() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -655,7 +655,7 @@ public class MockClusterInvokerTest { } @Test - public void testMockInvokerFromOverride_Invoke_force_throw() { + void testMockInvokerFromOverride_Invoke_force_throw() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -674,7 +674,7 @@ public class MockClusterInvokerTest { } @Test - public void testMockInvokerFromOverride_Invoke_force_throwCustemException() throws Throwable { + void testMockInvokerFromOverride_Invoke_force_throwCustemException() throws Throwable { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -693,7 +693,7 @@ public class MockClusterInvokerTest { } @Test - public void testMockInvokerFromOverride_Invoke_force_throwCustemExceptionNotFound() { + void testMockInvokerFromOverride_Invoke_force_throwCustemExceptionNotFound() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() @@ -712,7 +712,7 @@ public class MockClusterInvokerTest { } @Test - public void testMockInvokerFromOverride_Invoke_mock_false() { + void testMockInvokerFromOverride_Invoke_mock_false() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloService.class.getName()) .addParameter(REFER_KEY, URL.encode(PATH_KEY + "=" + IHelloService.class.getName() diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockProviderRpcExceptionTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockProviderRpcExceptionTest.java index 798067c0e5..89917f1de9 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockProviderRpcExceptionTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockProviderRpcExceptionTest.java @@ -40,7 +40,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.PATH_KEY; import static org.apache.dubbo.rpc.Constants.MOCK_KEY; import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY; -public class MockProviderRpcExceptionTest { +class MockProviderRpcExceptionTest { List> invokers = new ArrayList>(); @@ -53,7 +53,7 @@ public class MockProviderRpcExceptionTest { * Test if mock policy works fine: ProviderRpcException */ @Test - public void testMockInvokerProviderRpcException() { + void testMockInvokerProviderRpcException() { URL url = URL.valueOf("remote://1.2.3.4/" + IHelloRpcService.class.getName()); url = url.addParameter(MOCK_KEY, "true").addParameter("invoke_return_error", "true") .addParameter(REFER_KEY, diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java b/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java index cb98b661cb..ca028aed06 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java @@ -349,8 +349,12 @@ class URL implements Serializable { } public URL setProtocol(String protocol) { - URLAddress newURLAddress = urlAddress.setProtocol(protocol); - return returnURL(newURLAddress); + if (urlAddress == null) { + return new ServiceConfigURL(protocol, getHost(), getPort(), getPath(), getParameters()); + } else { + URLAddress newURLAddress = urlAddress.setProtocol(protocol); + return returnURL(newURLAddress); + } } public String getUsername() { @@ -358,8 +362,12 @@ class URL implements Serializable { } public URL setUsername(String username) { - URLAddress newURLAddress = urlAddress.setUsername(username); - return returnURL(newURLAddress); + if (urlAddress == null) { + return new ServiceConfigURL(getProtocol(), getHost(), getPort(), getPath(), getParameters()).setUsername(username); + } else { + URLAddress newURLAddress = urlAddress.setUsername(username); + return returnURL(newURLAddress); + } } public String getPassword() { @@ -367,8 +375,12 @@ class URL implements Serializable { } public URL setPassword(String password) { - URLAddress newURLAddress = urlAddress.setPassword(password); - return returnURL(newURLAddress); + if (urlAddress == null) { + return new ServiceConfigURL(getProtocol(), getHost(), getPort(), getPath(), getParameters()).setPassword(password); + } else { + URLAddress newURLAddress = urlAddress.setPassword(password); + return returnURL(newURLAddress); + } } /** @@ -425,8 +437,12 @@ class URL implements Serializable { } public URL setHost(String host) { - URLAddress newURLAddress = urlAddress.setHost(host); - return returnURL(newURLAddress); + if (urlAddress == null) { + return new ServiceConfigURL(getProtocol(), host, getPort(), getPath(), getParameters()); + } else { + URLAddress newURLAddress = urlAddress.setHost(host); + return returnURL(newURLAddress); + } } @@ -435,8 +451,12 @@ class URL implements Serializable { } public URL setPort(int port) { - URLAddress newURLAddress = urlAddress.setPort(port); - return returnURL(newURLAddress); + if (urlAddress == null) { + return new ServiceConfigURL(getProtocol(), getHost(), port, getPath(), getParameters()); + } else { + URLAddress newURLAddress = urlAddress.setPort(port); + return returnURL(newURLAddress); + } } public int getPort(int defaultPort) { @@ -445,7 +465,7 @@ class URL implements Serializable { } public String getAddress() { - return urlAddress.getAddress(); + return urlAddress == null ? null : urlAddress.getAddress(); } public URL setAddress(String address) { @@ -458,12 +478,16 @@ class URL implements Serializable { } else { host = address; } - URLAddress newURLAddress = urlAddress.setAddress(host, port); - return returnURL(newURLAddress); + if (urlAddress == null) { + return new ServiceConfigURL(getProtocol(), host, port, getPath(), getParameters()); + } else { + URLAddress newURLAddress = urlAddress.setAddress(host, port); + return returnURL(newURLAddress); + } } public String getIp() { - return urlAddress.getIp(); + return urlAddress == null ? null : urlAddress.getIp(); } public String getBackupAddress() { @@ -499,8 +523,12 @@ class URL implements Serializable { } public URL setPath(String path) { - URLAddress newURLAddress = urlAddress.setPath(path); - return returnURL(newURLAddress); + if (urlAddress == null) { + return new ServiceConfigURL(getProtocol(), getHost(), getPort(), path, getParameters()); + } else { + URLAddress newURLAddress = urlAddress.setPath(path); + return returnURL(newURLAddress); + } } public String getAbsolutePath() { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/BaseServiceMetadataTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/BaseServiceMetadataTest.java index 1075aec70d..6a9ed6e8b1 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/BaseServiceMetadataTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/BaseServiceMetadataTest.java @@ -22,10 +22,10 @@ import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_VERSION; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -public class BaseServiceMetadataTest { +class BaseServiceMetadataTest { @Test - public void test() { + void test() { BaseServiceMetadata baseServiceMetadata = new BaseServiceMetadata(); baseServiceMetadata.setGroup("group1"); baseServiceMetadata.setServiceInterfaceName("org.apache.dubbo.common.TestInterface"); @@ -63,4 +63,4 @@ public class BaseServiceMetadataTest { assertEquals(BaseServiceMetadata.revertDisplayServiceKey(null).getDisplayServiceKey(),"null:null"); assertEquals(BaseServiceMetadata.revertDisplayServiceKey("org.apache.dubbo.common.TestInterface:1.0.0:1").getDisplayServiceKey(),"null:null"); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/CommonScopeModelInitializerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/CommonScopeModelInitializerTest.java index d7794f55b0..93ec99bec7 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/CommonScopeModelInitializerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/CommonScopeModelInitializerTest.java @@ -32,7 +32,7 @@ import org.junit.jupiter.api.Test; /** * {@link CommonScopeModelInitializer} */ -public class CommonScopeModelInitializerTest { +class CommonScopeModelInitializerTest { private FrameworkModel frameworkModel; private ApplicationModel applicationModel; @@ -51,7 +51,7 @@ public class CommonScopeModelInitializerTest { } @Test - public void test() { + void test() { ScopeBeanFactory applicationModelBeanFactory = applicationModel.getBeanFactory(); Assertions.assertNotNull(applicationModelBeanFactory.getBean(ShutdownHookCallbacks.class)); Assertions.assertNotNull(applicationModelBeanFactory.getBean(FrameworkStatusReportService.class)); @@ -60,4 +60,4 @@ public class CommonScopeModelInitializerTest { ScopeBeanFactory moduleModelBeanFactory = moduleModel.getBeanFactory(); Assertions.assertNotNull(moduleModelBeanFactory.getBean(ConfigurationCache.class)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/InterfaceAddressURLTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/InterfaceAddressURLTest.java index 843cab8b59..010edb1b3f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/InterfaceAddressURLTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/InterfaceAddressURLTest.java @@ -27,13 +27,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotSame; -public class InterfaceAddressURLTest { +class InterfaceAddressURLTest { private static final String rawURL = "dubbo://10.20.130.230:20880/context/path?version=1.0.0&group=g1&application=provider&timeout=1000&category=provider&side=provider&sayHello.weight=222"; private static final URL overrideURL = URL.valueOf("override://10.20.130.230:20880/context/path?version=1.0.0&application=morgan&timeout=2000&category=configurators&sayHello.overrideKey=override"); private static final URL consumerURL = URL.valueOf("consumer://10.20.130.230/context/path?version=2.0.0,1.0.0&group=g2&application=morgan&timeout=3000&side=consumer&sayHello.timeout=5000"); @Test - public void testMergeOverriden() { + void testMergeOverriden() { URL url = URL.valueOf(rawURL); ServiceAddressURL interfaceAddressURL = new DubboServiceAddressURL(url.getUrlAddress(), url.getUrlParam(), null, null); assertEquals("1000", interfaceAddressURL.getParameter(TIMEOUT_KEY)); @@ -46,7 +46,7 @@ public class InterfaceAddressURLTest { } @Test - public void testGetParameter() { + void testGetParameter() { URL url = URL.valueOf(rawURL); ServiceAddressURL interfaceAddressURL = new DubboServiceAddressURL(url.getUrlAddress(), url.getUrlParam(), consumerURL, null); @@ -64,7 +64,7 @@ public class InterfaceAddressURLTest { } @Test - public void testGetMethodParameter() { + void testGetMethodParameter() { URL url = URL.valueOf(rawURL); ServiceAddressURL interfaceAddressURL = new DubboServiceAddressURL(url.getUrlAddress(), url.getUrlParam(), consumerURL, (ServiceConfigURL) overrideURL); @@ -76,7 +76,7 @@ public class InterfaceAddressURLTest { } @Test - public void testURLEquals() { + void testURLEquals() { URL url1 = URL.valueOf(rawURL); URL url2 = URL.valueOf(rawURL); assertNotSame(url1, url2); @@ -95,7 +95,7 @@ public class InterfaceAddressURLTest { } @Test - public void testToString() { + void testToString() { URL url1 = URL.valueOf(rawURL); System.out.println(url1.toString()); ServiceAddressURL withConsumer = new DubboServiceAddressURL(url1.getUrlAddress(), url1.getUrlParam(), consumerURL, null); @@ -103,4 +103,4 @@ public class InterfaceAddressURLTest { ServiceAddressURL withOverride2 = new DubboServiceAddressURL(url1.getUrlAddress(), url1.getUrlParam(), consumerURL, (ServiceConfigURL) overrideURL); System.out.println(withOverride2.toString()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/PojoUtilsForNonPublicStaticTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/PojoUtilsForNonPublicStaticTest.java index 8e1e5a569d..3b7a5fa057 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/PojoUtilsForNonPublicStaticTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/PojoUtilsForNonPublicStaticTest.java @@ -20,10 +20,10 @@ import org.apache.dubbo.common.utils.PojoUtils; import org.junit.jupiter.api.Test; -public class PojoUtilsForNonPublicStaticTest { +class PojoUtilsForNonPublicStaticTest { @Test - public void testNonPublicStaticClass() { + void testNonPublicStaticClass() { NonPublicStaticData nonPublicStaticData = new NonPublicStaticData("horizon"); PojoUtils.generalize(nonPublicStaticData); } @@ -47,4 +47,4 @@ public class PojoUtilsForNonPublicStaticTest { this.name = name; } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/ProtocolServiceKeyMatcherTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/ProtocolServiceKeyMatcherTest.java index 635045c408..4b20f87d9d 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/ProtocolServiceKeyMatcherTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/ProtocolServiceKeyMatcherTest.java @@ -19,10 +19,10 @@ package org.apache.dubbo.common; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ProtocolServiceKeyMatcherTest { +class ProtocolServiceKeyMatcherTest { @Test - public void testProtocol() { + void testProtocol() { Assertions.assertTrue(ProtocolServiceKey.Matcher.isMatch( new ProtocolServiceKey(null, null, null, "dubbo"), new ProtocolServiceKey(null, null, null, "dubbo") @@ -104,4 +104,4 @@ public class ProtocolServiceKeyMatcherTest { new ProtocolServiceKey(null, null, null, "dubbo") )); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/ProtocolServiceKeyTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/ProtocolServiceKeyTest.java index 09b2711aa2..8d50abbd42 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/ProtocolServiceKeyTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/ProtocolServiceKeyTest.java @@ -19,9 +19,9 @@ package org.apache.dubbo.common; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ProtocolServiceKeyTest { +class ProtocolServiceKeyTest { @Test - public void test() { + void test() { ProtocolServiceKey protocolServiceKey = new ProtocolServiceKey("DemoService", "1.0.0", "group1", "protocol1"); Assertions.assertEquals("DemoService", protocolServiceKey.getInterfaceName()); Assertions.assertEquals("1.0.0", protocolServiceKey.getVersion()); @@ -73,4 +73,4 @@ public class ProtocolServiceKeyTest { Assertions.assertFalse(protocolServiceKey7.isSameWith(new ProtocolServiceKey("DemoService", "1.0.0", "group1", "protocol1"))); Assertions.assertFalse(protocolServiceKey7.isSameWith(new ProtocolServiceKey("DemoService", "1.0.0", "group1", "protocol2"))); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/ServiceKeyMatcherTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/ServiceKeyMatcherTest.java index 6d85c46b31..180a1e21a0 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/ServiceKeyMatcherTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/ServiceKeyMatcherTest.java @@ -19,10 +19,10 @@ package org.apache.dubbo.common; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ServiceKeyMatcherTest { +class ServiceKeyMatcherTest { @Test - public void testInterface() { + void testInterface() { Assertions.assertTrue(ServiceKey.Matcher.isMatch( new ServiceKey(null, null, null), new ServiceKey(null, null, null) @@ -48,7 +48,7 @@ public class ServiceKeyMatcherTest { } @Test - public void testVersion() { + void testVersion() { Assertions.assertTrue(ServiceKey.Matcher.isMatch( new ServiceKey(null, "1.0.0", null), new ServiceKey(null, "1.0.0", null) @@ -142,7 +142,7 @@ public class ServiceKeyMatcherTest { } @Test - public void testGroup() { + void testGroup() { Assertions.assertTrue(ServiceKey.Matcher.isMatch( new ServiceKey(null, null, "group1"), new ServiceKey(null, null, "group1") @@ -221,4 +221,4 @@ public class ServiceKeyMatcherTest { new ServiceKey(null, null, "group1") )); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/ServiceKeyTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/ServiceKeyTest.java index 5643166ffa..d0833c6029 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/ServiceKeyTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/ServiceKeyTest.java @@ -19,9 +19,9 @@ package org.apache.dubbo.common; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ServiceKeyTest { +class ServiceKeyTest { @Test - public void test() { + void test() { ServiceKey serviceKey = new ServiceKey("DemoService", "1.0.0", "group1"); Assertions.assertEquals("DemoService", serviceKey.getInterfaceName()); @@ -51,4 +51,4 @@ public class ServiceKeyTest { ProtocolServiceKey protocolServiceKey = new ProtocolServiceKey("DemoService", "1.0.0", "group1", "protocol1"); Assertions.assertNotEquals(serviceKey, protocolServiceKey); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/URLBuilderTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/URLBuilderTest.java index e0839696ae..9967a7bd02 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/URLBuilderTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/URLBuilderTest.java @@ -27,15 +27,15 @@ import java.util.Map; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; -public class URLBuilderTest { +class URLBuilderTest { @Test - public void testNoArgConstructor() { + void testNoArgConstructor() { URL url = new URLBuilder().build(); assertThat(url.toString(), equalTo("")); } @Test - public void shouldAddParameter() { + void shouldAddParameter() { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); URL url2 = URLBuilder.from(url1) .addParameter("newKey1", "newValue1") // string @@ -48,7 +48,7 @@ public class URLBuilderTest { } @Test - public void shouldSet() { + void shouldSet() { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); int port = NetUtils.getAvailablePort(); URL url2 = URLBuilder.from(url1) @@ -75,7 +75,7 @@ public class URLBuilderTest { } @Test - public void shouldClearParameters() { + void shouldClearParameters() { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); URL url2 = URLBuilder.from(url1) .clearParameters() @@ -84,7 +84,7 @@ public class URLBuilderTest { } @Test - public void shouldRemoveParameters() { + void shouldRemoveParameters() { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan&key2=v2"); URL url2 = URLBuilder.from(url1) .removeParameters(Arrays.asList("key2", "application")) @@ -94,7 +94,7 @@ public class URLBuilderTest { } @Test - public void shouldAddIfAbsent() { + void shouldAddIfAbsent() { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan&key2=v2"); URL url2 = URLBuilder.from(url1) .addParameterIfAbsent("absentKey", "absentValue") @@ -105,7 +105,7 @@ public class URLBuilderTest { } @Test - public void shouldAddParameters() { + void shouldAddParameters() { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan&key2=v2"); // string pairs test @@ -130,7 +130,7 @@ public class URLBuilderTest { } @Test - public void shouldAddParametersIfAbsent() { + void shouldAddParametersIfAbsent() { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan&key2=v2"); Map parameters = new HashMap(){ @@ -145,4 +145,4 @@ public class URLBuilderTest { assertThat(url2.getParameter("version"), equalTo("1.0.0")); assertThat(url2.getParameter("absentKey"), equalTo("absentValue")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/URLStrParserTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/URLStrParserTest.java index fdd3533361..aea2001306 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/URLStrParserTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/URLStrParserTest.java @@ -29,7 +29,7 @@ import static org.hamcrest.MatcherAssert.assertThat; /** * Created by LinShunkang on 2020/03/12 */ -public class URLStrParserTest { +class URLStrParserTest { private static Set testCases = new HashSet<>(16); private static Set errorDecodedCases = new HashSet<>(8); private static Set errorEncodedCases = new HashSet<>(8); @@ -57,7 +57,7 @@ public class URLStrParserTest { } @Test - public void testEncoded() { + void testEncoded() { testCases.forEach(testCase -> { assertThat(URLStrParser.parseEncodedStr(URL.encode(testCase)), equalTo(URL.valueOf(testCase))); }); @@ -69,7 +69,7 @@ public class URLStrParserTest { } @Test - public void testDecoded() { + void testDecoded() { testCases.forEach(testCase -> { assertThat(URLStrParser.parseDecodedStr(testCase), equalTo(URL.valueOf(testCase))); }); @@ -80,4 +80,4 @@ public class URLStrParserTest { }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/URLTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/URLTest.java index 033901bd89..a4400eebef 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/URLTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/URLTest.java @@ -18,6 +18,7 @@ package org.apache.dubbo.common; import org.apache.dubbo.common.url.component.ServiceConfigURL; import org.apache.dubbo.common.utils.CollectionUtils; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -40,10 +41,10 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -public class URLTest { +class URLTest { @Test - public void test_ignore_pond() { + void test_ignore_pond() { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path#index?version=1.0.0&id=org.apache.dubbo.config.RegistryConfig#0"); assertURLStrDecoder(url); assertEquals("dubbo", url.getProtocol()); @@ -59,7 +60,7 @@ public class URLTest { } @Test - public void test_valueOf_noProtocolAndHost() throws Exception { + void test_valueOf_noProtocolAndHost() throws Exception { URL url = URL.valueOf("/context/path?version=1.0.0&application=morgan"); assertURLStrDecoder(url); assertNull(url.getProtocol()); @@ -97,7 +98,7 @@ public class URLTest { } @Test - public void test_valueOf_noProtocol() throws Exception { + void test_valueOf_noProtocol() throws Exception { URL url = URL.valueOf("10.20.130.230"); assertURLStrDecoder(url); assertNull(url.getProtocol()); @@ -157,7 +158,7 @@ public class URLTest { } @Test - public void test_valueOf_noHost() throws Exception { + void test_valueOf_noHost() throws Exception { URL url = URL.valueOf("file:///home/user1/router.js"); assertURLStrDecoder(url); assertEquals("file", url.getProtocol()); @@ -236,7 +237,7 @@ public class URLTest { } @Test - public void test_valueOf_WithProtocolHost() throws Exception { + void test_valueOf_WithProtocolHost() throws Exception { URL url = URL.valueOf("dubbo://10.20.130.230"); assertURLStrDecoder(url); assertEquals("dubbo", url.getProtocol()); @@ -312,7 +313,7 @@ public class URLTest { // TODO Do not want to use spaces? See: DUBBO-502, URL class handles special conventions for special characters. @Test - public void test_valueOf_spaceSafe() throws Exception { + void test_valueOf_spaceSafe() throws Exception { URL url = URL.valueOf("http://1.2.3.4:8080/path?key=value1 value2"); assertURLStrDecoder(url); assertEquals("http://1.2.3.4:8080/path?key=value1 value2", url.toString()); @@ -320,7 +321,7 @@ public class URLTest { } @Test - public void test_noValueKey() throws Exception { + void test_noValueKey() throws Exception { URL url = URL.valueOf("http://1.2.3.4:8080/path?k0=&k1=v1"); assertURLStrDecoder(url); @@ -331,7 +332,7 @@ public class URLTest { } @Test - public void test_valueOf_Exception_noProtocol() throws Exception { + void test_valueOf_Exception_noProtocol() throws Exception { try { URL.valueOf("://1.2.3.4:8080/path"); fail(); @@ -356,14 +357,14 @@ public class URLTest { } @Test - public void test_getAddress() throws Exception { + void test_getAddress() throws Exception { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); assertURLStrDecoder(url1); assertEquals("10.20.130.230:20880", url1.getAddress()); } @Test - public void test_getAbsolutePath() throws Exception { + void test_getAbsolutePath() throws Exception { URL url = new ServiceConfigURL("p1", "1.2.2.2", 33); assertURLStrDecoder(url); assertNull(url.getAbsolutePath()); @@ -374,7 +375,7 @@ public class URLTest { } @Test - public void test_equals() throws Exception { + void test_equals() throws Exception { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); assertURLStrDecoder(url1); @@ -388,7 +389,7 @@ public class URLTest { } @Test - public void test_toString() throws Exception { + void test_toString() throws Exception { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); assertURLStrDecoder(url1); assertThat(url1.toString(), anyOf( @@ -398,7 +399,7 @@ public class URLTest { } @Test - public void test_toFullString() throws Exception { + void test_toFullString() throws Exception { URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); assertURLStrDecoder(url1); assertThat(url1.toFullString(), anyOf( @@ -408,7 +409,7 @@ public class URLTest { } @Test - public void test_set_methods() throws Exception { + void test_set_methods() throws Exception { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); assertURLStrDecoder(url); @@ -498,7 +499,7 @@ public class URLTest { } @Test - public void test_removeParameters() throws Exception { + void test_removeParameters() throws Exception { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan&k1=v1&k2=v2"); assertURLStrDecoder(url); @@ -551,7 +552,7 @@ public class URLTest { } @Test - public void test_addParameter() throws Exception { + void test_addParameter() throws Exception { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?application=morgan"); url = url.addParameter("k1", "v1"); @@ -569,7 +570,7 @@ public class URLTest { } @Test - public void test_addParameter_sameKv() throws Exception { + void test_addParameter_sameKv() throws Exception { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?application=morgan&k1=v1"); URL newUrl = url.addParameter("k1", "v1"); @@ -579,7 +580,7 @@ public class URLTest { @Test - public void test_addParameters() throws Exception { + void test_addParameters() throws Exception { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?application=morgan"); url = url.addParameters(CollectionUtils.toStringMap("k1", "v1", "k2", "v2")); @@ -659,7 +660,7 @@ public class URLTest { } @Test - public void test_addParameters_SameKv() throws Exception { + void test_addParameters_SameKv() throws Exception { { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?application=morgan&k1=v1"); URL newUrl = url.addParameters(CollectionUtils.toStringMap("k1", "v1")); @@ -677,7 +678,7 @@ public class URLTest { } @Test - public void test_addParameterIfAbsent() throws Exception { + void test_addParameterIfAbsent() throws Exception { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?application=morgan"); url = url.addParameterIfAbsent("application", "xxx"); @@ -694,7 +695,7 @@ public class URLTest { } @Test - public void test_windowAbsolutePathBeginWithSlashIsValid() throws Exception { + void test_windowAbsolutePathBeginWithSlashIsValid() throws Exception { final String osProperty = System.getProperties().getProperty(OS_NAME_KEY); if (!osProperty.toLowerCase().contains(OS_WIN_PREFIX)) return; @@ -714,7 +715,7 @@ public class URLTest { } @Test - public void test_javaNetUrl() throws Exception { + void test_javaNetUrl() throws Exception { java.net.URL url = new java.net.URL("http://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan#anchor1"); assertEquals("http", url.getProtocol()); @@ -730,7 +731,7 @@ public class URLTest { } @Test - public void test_Anyhost() throws Exception { + void test_Anyhost() throws Exception { URL url = URL.valueOf("dubbo://0.0.0.0:20880"); assertURLStrDecoder(url); assertEquals("0.0.0.0", url.getHost()); @@ -738,7 +739,7 @@ public class URLTest { } @Test - public void test_Localhost() throws Exception { + void test_Localhost() throws Exception { URL url = URL.valueOf("dubbo://127.0.0.1:20880"); assertURLStrDecoder(url); assertEquals("127.0.0.1", url.getHost()); @@ -759,14 +760,14 @@ public class URLTest { } @Test - public void test_Path() throws Exception { + void test_Path() throws Exception { URL url = new ServiceConfigURL("dubbo", "localhost", 20880, "////path"); assertURLStrDecoder(url); assertEquals("path", url.getPath()); } @Test - public void testAddParameters() throws Exception { + void testAddParameters() throws Exception { URL url = URL.valueOf("dubbo://127.0.0.1:20880"); assertURLStrDecoder(url); @@ -777,7 +778,7 @@ public class URLTest { } @Test - public void testUserNamePasswordContainsAt() { + void testUserNamePasswordContainsAt() { // Test username or password contains "@" URL url = URL.valueOf("ad@min:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); assertURLStrDecoder(url); @@ -795,7 +796,7 @@ public class URLTest { @Test - public void testIpV6Address() { + void testIpV6Address() { // Test username or password contains "@" URL url = URL.valueOf("ad@min111:haha@1234@2001:0db8:85a3:08d3:1319:8a2e:0370:7344:20880/context/path?version=1.0.0&application=morgan"); assertURLStrDecoder(url); @@ -812,7 +813,7 @@ public class URLTest { } @Test - public void testIpV6AddressWithScopeId() { + void testIpV6AddressWithScopeId() { URL url = URL.valueOf("2001:0db8:85a3:08d3:1319:8a2e:0370:7344%5/context/path?version=1.0.0&application=morgan"); assertURLStrDecoder(url); assertNull(url.getProtocol()); @@ -826,13 +827,13 @@ public class URLTest { } @Test - public void testDefaultPort() { + void testDefaultPort() { Assertions.assertEquals("10.20.153.10:2181", URL.appendDefaultPort("10.20.153.10:0", 2181)); Assertions.assertEquals("10.20.153.10:2181", URL.appendDefaultPort("10.20.153.10", 2181)); } @Test - public void testGetServiceKey() { + void testGetServiceKey() { URL url1 = URL.valueOf("10.20.130.230:20880/context/path?interface=org.apache.dubbo.test.interfaceName"); assertURLStrDecoder(url1); Assertions.assertEquals("org.apache.dubbo.test.interfaceName", url1.getServiceKey()); @@ -855,7 +856,7 @@ public class URLTest { } @Test - public void testGetColonSeparatedKey() { + void testGetColonSeparatedKey() { URL url1 = URL.valueOf("10.20.130.230:20880/context/path?interface=org.apache.dubbo.test.interfaceName&group=group&version=1.0.0"); assertURLStrDecoder(url1); Assertions.assertEquals("org.apache.dubbo.test.interfaceName:1.0.0:group", url1.getColonSeparatedKey()); @@ -882,7 +883,7 @@ public class URLTest { } @Test - public void testValueOf() { + void testValueOf() { URL url = URL.valueOf("10.20.130.230"); assertURLStrDecoder(url); @@ -903,7 +904,7 @@ public class URLTest { * @since 2.7.8 */ @Test - public void testGetParameters() { + void testGetParameters() { URL url = URL.valueOf("10.20.130.230:20880/context/path?interface=org.apache.dubbo.test.interfaceName&group=group&version=1.0.0"); Map parameters = url.getParameters(i -> "version".equals(i)); String version = parameters.get("version"); @@ -912,14 +913,14 @@ public class URLTest { } @Test - public void testGetParameter() { + void testGetParameter() { URL url = URL.valueOf("http://127.0.0.1:8080/path?i=1&b=false"); assertEquals(Integer.valueOf(1), url.getParameter("i", Integer.class)); assertEquals(Boolean.FALSE, url.getParameter("b", Boolean.class)); } @Test - public void testEquals() { + void testEquals() { URL url1 = URL.valueOf("10.20.130.230:20880/context/path?interface=org.apache.dubbo.test.interfaceName&group=group&version=1.0.0"); URL url2 = URL.valueOf("10.20.130.230:20880/context/path?interface=org.apache.dubbo.test.interfaceName&group=group&version=1.0.0"); Assertions.assertEquals(url1, url2); @@ -955,7 +956,7 @@ public class URLTest { @Test - public void testEqualsWithPassword() { + void testEqualsWithPassword() { URL url1 = URL.valueOf("ad@min:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); URL url2 = URL.valueOf("ad@min:hello@4321@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); URL url3 = URL.valueOf("ad@min:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); @@ -967,7 +968,7 @@ public class URLTest { } @Test - public void testEqualsWithPath() { + void testEqualsWithPath() { URL url1 = URL.valueOf("ad@min:hello@1234@10.20.130.230:20880/context/path1?version=1.0.0&application=morgan"); URL url2 = URL.valueOf("ad@min:hello@1234@10.20.130.230:20880/context/path2?version=1.0.0&application=morgan"); URL url3 = URL.valueOf("ad@min:hello@1234@10.20.130.230:20880/context/path1?version=1.0.0&application=morgan"); @@ -979,7 +980,7 @@ public class URLTest { } @Test - public void testEqualsWithPort() { + void testEqualsWithPort() { URL url1 = URL.valueOf("ad@min:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); URL url2 = URL.valueOf("ad@min:hello@1234@10.20.130.230:20881/context/path?version=1.0.0&application=morgan"); URL url3 = URL.valueOf("ad@min:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); @@ -991,7 +992,7 @@ public class URLTest { } @Test - public void testEqualsWithProtocol() { + void testEqualsWithProtocol() { URL url1 = URL.valueOf("dubbo://ad@min:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); URL url2 = URL.valueOf("file://ad@min:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); URL url3 = URL.valueOf("dubbo://ad@min:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); @@ -1003,7 +1004,7 @@ public class URLTest { } @Test - public void testEqualsWithUser() { + void testEqualsWithUser() { URL url1 = URL.valueOf("ad@min1:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); URL url2 = URL.valueOf("ad@min2:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); URL url3 = URL.valueOf("ad@min1:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan"); @@ -1015,7 +1016,7 @@ public class URLTest { } @Test - public void testHashcode() { + void testHashcode() { URL url1 = URL.valueOf("consumer://30.225.20.150/org.apache.dubbo.rpc.service.GenericService?application=" + "dubbo-demo-api-consumer&category=consumers&check=false&dubbo=2.0.2&generic=true&interface=" + "org.apache.dubbo.demo.DemoService&pid=7375&side=consumer&sticky=false×tamp=1599556506417"); @@ -1036,7 +1037,7 @@ public class URLTest { } @Test - public void testParameterContainPound() { + void testParameterContainPound() { URL url = URL.valueOf( "dubbo://ad@min:hello@1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan£=abcd#efg&protocol=registry"); Assertions.assertEquals("abcd#efg", url.getParameter("pound")); @@ -1044,13 +1045,13 @@ public class URLTest { } @Test - public void test_valueOfHasNameWithoutValue() throws Exception { + void test_valueOfHasNameWithoutValue() throws Exception { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan&noValue"); Assertions.assertEquals("noValue", url.getParameter("noValue")); } @Test - public void testGetAuthority() { + void testGetAuthority() { URL url = URL.valueOf("admin1:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=app1"); assertEquals("admin1:hello1234@10.20.130.230:20880", url.getAuthority()); @@ -1068,7 +1069,7 @@ public class URLTest { } @Test - public void testGetUserInformation() { + void testGetUserInformation() { URL url = URL.valueOf("admin1:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=app1"); assertEquals("admin1:hello1234", url.getUserInformation()); @@ -1084,7 +1085,7 @@ public class URLTest { @Test - public void testIPV6() { + void testIPV6() { URL url = URL.valueOf("dubbo://[2408:4004:194:8896:3e8a:82ae:814a:398]:20881?name=apache"); assertEquals("[2408:4004:194:8896:3e8a:82ae:814a:398]", url.getHost()); assertEquals(20881, url.getPort()); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/beans/InstantiationStrategyTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/beans/InstantiationStrategyTest.java index c54fe383c4..69ba384612 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/beans/InstantiationStrategyTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/beans/InstantiationStrategyTest.java @@ -31,7 +31,7 @@ import org.apache.dubbo.rpc.model.ScopeModelAccessor; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class InstantiationStrategyTest { +class InstantiationStrategyTest { private ScopeModelAccessor scopeModelAccessor = new ScopeModelAccessor() { @Override @@ -41,7 +41,7 @@ public class InstantiationStrategyTest { }; @Test - public void testCreateBeanWithScopeModelArgument() throws ReflectiveOperationException { + void testCreateBeanWithScopeModelArgument() throws ReflectiveOperationException { InstantiationStrategy instantiationStrategy = new InstantiationStrategy(scopeModelAccessor); FooBeanWithFrameworkModel beanWithFrameworkModel = instantiationStrategy.instantiate(FooBeanWithFrameworkModel.class); @@ -67,4 +67,4 @@ public class InstantiationStrategyTest { } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/beans/ScopeBeanFactoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/beans/ScopeBeanFactoryTest.java index 8a5fa08fed..a15bd80bcf 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/beans/ScopeBeanFactoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/beans/ScopeBeanFactoryTest.java @@ -25,10 +25,10 @@ import org.apache.dubbo.rpc.model.FrameworkModel; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ScopeBeanFactoryTest { +class ScopeBeanFactoryTest { @Test - public void testInjection() { + void testInjection() { ApplicationModel applicationModel = ApplicationModel.defaultModel(); ScopeBeanFactory beanFactory = applicationModel.getBeanFactory(); @@ -54,4 +54,4 @@ public class ScopeBeanFactoryTest { Assertions.assertTrue(beanWithApplicationModel.isDestroyed()); Assertions.assertTrue(beanWithFrameworkModel.isDestroyed()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanAccessorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanAccessorTest.java index 55bbc598ec..eb1118479f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanAccessorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanAccessorTest.java @@ -19,19 +19,19 @@ package org.apache.dubbo.common.beanutil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class JavaBeanAccessorTest { +class JavaBeanAccessorTest { @Test - public void testIsAccessByMethod(){ + void testIsAccessByMethod(){ Assertions.assertTrue(JavaBeanAccessor.isAccessByMethod(JavaBeanAccessor.METHOD)); Assertions.assertTrue(JavaBeanAccessor.isAccessByMethod(JavaBeanAccessor.ALL)); Assertions.assertFalse(JavaBeanAccessor.isAccessByMethod(JavaBeanAccessor.FIELD)); } @Test - public void testIsAccessByField(){ + void testIsAccessByField(){ Assertions.assertTrue(JavaBeanAccessor.isAccessByField(JavaBeanAccessor.FIELD)); Assertions.assertTrue(JavaBeanAccessor.isAccessByField(JavaBeanAccessor.ALL)); Assertions.assertFalse(JavaBeanAccessor.isAccessByField(JavaBeanAccessor.METHOD)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java index 053bdd4dc5..9231a32c10 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java @@ -35,10 +35,10 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -public class JavaBeanSerializeUtilTest { +class JavaBeanSerializeUtilTest { @Test - public void testSerialize_Primitive() { + void testSerialize_Primitive() { JavaBeanDescriptor descriptor; descriptor = JavaBeanSerializeUtil.serialize(Integer.MAX_VALUE); Assertions.assertTrue(descriptor.isPrimitiveType()); @@ -51,14 +51,14 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testSerialize_Primitive_NUll() { + void testSerialize_Primitive_NUll() { JavaBeanDescriptor descriptor; descriptor = JavaBeanSerializeUtil.serialize(null); Assertions.assertNull(descriptor); } @Test - public void testDeserialize_Primitive() { + void testDeserialize_Primitive() { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); descriptor.setPrimitiveProperty(Long.MAX_VALUE); Assertions.assertEquals(Long.MAX_VALUE, JavaBeanSerializeUtil.deserialize(descriptor)); @@ -73,7 +73,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testDeserialize_Primitive0() { + void testDeserialize_Primitive0() { Assertions.assertThrows(IllegalArgumentException.class, () -> { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_BEAN + 1); @@ -81,14 +81,14 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testDeserialize_Null() { + void testDeserialize_Null() { Assertions.assertThrows(IllegalArgumentException.class, () -> { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(null, JavaBeanDescriptor.TYPE_BEAN); }); } @Test - public void testDeserialize_containsProperty() { + void testDeserialize_containsProperty() { Assertions.assertThrows(IllegalArgumentException.class, () -> { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); @@ -97,7 +97,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testSetEnumNameProperty() { + void testSetEnumNameProperty() { Assertions.assertThrows(IllegalStateException.class, () -> { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); @@ -115,7 +115,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testGetEnumNameProperty() { + void testGetEnumNameProperty() { Assertions.assertThrows(IllegalStateException.class, () -> { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); @@ -124,7 +124,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testSetClassNameProperty() { + void testSetClassNameProperty() { Assertions.assertThrows(IllegalStateException.class, () -> { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), @@ -143,7 +143,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testGetClassNameProperty() { + void testGetClassNameProperty() { Assertions.assertThrows(IllegalStateException.class, () -> { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); @@ -152,7 +152,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testSetPrimitiveProperty() { + void testSetPrimitiveProperty() { Assertions.assertThrows(IllegalStateException.class, () -> { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(JavaBeanDescriptor.class.getName(), JavaBeanDescriptor.TYPE_BEAN); @@ -161,7 +161,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testGetPrimitiveProperty() { + void testGetPrimitiveProperty() { Assertions.assertThrows(IllegalStateException.class, () -> { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(JavaBeanDescriptor.class.getName(), JavaBeanDescriptor.TYPE_BEAN); @@ -170,7 +170,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testDeserialize_get_and_set() { + void testDeserialize_get_and_set() { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_BEAN); descriptor.setType(JavaBeanDescriptor.TYPE_PRIMITIVE); Assertions.assertEquals(descriptor.getType(), JavaBeanDescriptor.TYPE_PRIMITIVE); @@ -179,7 +179,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testSerialize_Array() { + void testSerialize_Array() { int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9}; JavaBeanDescriptor descriptor = JavaBeanSerializeUtil.serialize(array, JavaBeanAccessor.METHOD); Assertions.assertTrue(descriptor.isArrayType()); @@ -226,7 +226,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testConstructorArg() { + void testConstructorArg() { Assertions.assertFalse((boolean) JavaBeanSerializeUtil.getConstructorArg(boolean.class)); Assertions.assertFalse((boolean) JavaBeanSerializeUtil.getConstructorArg(Boolean.class)); Assertions.assertEquals((byte) 0, JavaBeanSerializeUtil.getConstructorArg(byte.class)); @@ -247,7 +247,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testDeserialize_Array() { + void testDeserialize_Array() { final int len = 10; JavaBeanDescriptor descriptor = new JavaBeanDescriptor(int.class.getName(), JavaBeanDescriptor.TYPE_ARRAY); for (int i = 0; i < len; i++) { @@ -299,7 +299,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void test_Circular_Reference() { + void test_Circular_Reference() { PojoUtilsTest.Parent parent = new PojoUtilsTest.Parent(); parent.setAge(Integer.MAX_VALUE); parent.setEmail("a@b"); @@ -325,7 +325,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testBeanSerialize() { + void testBeanSerialize() { Bean bean = new Bean(); bean.setDate(new Date()); bean.setStatus(PersonStatus.ENABLED); @@ -375,7 +375,7 @@ public class JavaBeanSerializeUtilTest { } @Test - public void testDeserializeBean() { + void testDeserializeBean() { Bean bean = new Bean(); bean.setDate(new Date()); bean.setStatus(PersonStatus.ENABLED); @@ -544,4 +544,4 @@ public class JavaBeanSerializeUtilTest { bigPerson.setInfoProfile(pi); return bigPerson; } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ClassGeneratorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ClassGeneratorTest.java index 94837548f2..9cef0a3468 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ClassGeneratorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ClassGeneratorTest.java @@ -48,10 +48,10 @@ class BaseClass { interface BaseInterface { } -public class ClassGeneratorTest { +class ClassGeneratorTest { @Test - public void test() throws Exception { + void test() throws Exception { ClassGenerator cg = ClassGenerator.newInstance(); // add className, interface, superClass @@ -147,7 +147,7 @@ public class ClassGeneratorTest { @SuppressWarnings("unchecked") @Test - public void testMain() throws Exception { + void testMain() throws Exception { Bean b = new Bean(); Field fname = Bean.class.getDeclaredField("name"); fname.setAccessible(true); @@ -173,7 +173,7 @@ public class ClassGeneratorTest { } @Test - public void testMain0() throws Exception { + void testMain0() throws Exception { Bean b = new Bean(); Field fname = Bean.class.getDeclaredField("name"); fname.setAccessible(true); @@ -213,4 +213,4 @@ class Bean { } public static volatile String abc = "df"; -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/MixinTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/MixinTest.java index b6a825e235..64cc7fc28f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/MixinTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/MixinTest.java @@ -20,10 +20,10 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertTrue; -public class MixinTest { +class MixinTest { @Test - public void testMain() throws Exception { + void testMain() throws Exception { Mixin mixin = Mixin.mixin(new Class[]{I1.class, I2.class, I3.class}, new Class[]{C1.class, C2.class}); Object o = mixin.newInstance(new Object[]{new C1(), new C2()}); assertTrue(o instanceof I1); @@ -69,4 +69,4 @@ public class MixinTest { System.out.println("setMixinInstance:" + mi); } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java index f607f69f38..6a6e1df794 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java @@ -27,10 +27,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; @DisabledForJreRange(min = JRE.JAVA_16) -public class ProxyTest { +class ProxyTest { @Test - public void testMain() throws Exception { + void testMain() throws Exception { Proxy proxy = Proxy.getProxy(ITest.class, ITest.class); ITest instance = (ITest) proxy.newInstance((proxy1, method, args) -> { if ("getName".equals(method.getName())) { @@ -48,7 +48,7 @@ public class ProxyTest { } @Test - public void testCglibProxy() throws Exception { + void testCglibProxy() throws Exception { ITest test = (ITest) Proxy.getProxy(ITest.class).newInstance((proxy, method, args) -> { System.out.println(method.getName()); return null; @@ -74,4 +74,4 @@ public class ProxyTest { return "Bye!"; } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java index 39fa87172a..8268494421 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java @@ -26,9 +26,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.fail; -public class WrapperTest { +class WrapperTest { @Test - public void testMain() throws Exception { + void testMain() throws Exception { Wrapper w = Wrapper.getWrapper(I1.class); String[] ns = w.getDeclaredMethodNames(); assertEquals(ns.length, 5); @@ -52,7 +52,7 @@ public class WrapperTest { // bug: DUBBO-132 @Test - public void test_unwantedArgument() throws Exception { + void test_unwantedArgument() throws Exception { Wrapper w = Wrapper.getWrapper(I1.class); Object obj = new Impl1(); try { @@ -65,12 +65,12 @@ public class WrapperTest { //bug: DUBBO-425 @Test - public void test_makeEmptyClass() throws Exception { + void test_makeEmptyClass() throws Exception { Wrapper.getWrapper(EmptyServiceImpl.class); } @Test - public void testHasMethod() throws Exception { + void testHasMethod() throws Exception { Wrapper w = Wrapper.getWrapper(I1.class); Assertions.assertTrue(w.hasMethod("setName")); Assertions.assertTrue(w.hasMethod("hello")); @@ -81,7 +81,7 @@ public class WrapperTest { } @Test - public void testWrapperObject() throws Exception { + void testWrapperObject() throws Exception { Wrapper w = Wrapper.getWrapper(Object.class); Assertions.assertEquals(4, w.getMethodNames().length); Assertions.assertEquals(4, w.getDeclaredMethodNames().length); @@ -91,7 +91,7 @@ public class WrapperTest { } @Test - public void testGetPropertyValue() throws Exception { + void testGetPropertyValue() throws Exception { Assertions.assertThrows(NoSuchPropertyException.class, () -> { Wrapper w = Wrapper.getWrapper(Object.class); w.getPropertyValue(null, null); @@ -99,7 +99,7 @@ public class WrapperTest { } @Test - public void testSetPropertyValue() throws Exception { + void testSetPropertyValue() throws Exception { Assertions.assertThrows(NoSuchPropertyException.class, () -> { Wrapper w = Wrapper.getWrapper(Object.class); w.setPropertyValue(null, null, null); @@ -107,14 +107,14 @@ public class WrapperTest { } @Test - public void testWrapPrimitive() throws Exception { + void testWrapPrimitive() throws Exception { Assertions.assertThrows(IllegalArgumentException.class, () -> { Wrapper.getWrapper(Byte.TYPE); }); } @Test - public void testInvokeWrapperObject() throws Exception { + void testInvokeWrapperObject() throws Exception { Wrapper w = Wrapper.getWrapper(Object.class); Object instance = new Object(); Assertions.assertEquals(instance.getClass(), w.invokeMethod(instance, "getClass", null, null)); @@ -126,7 +126,7 @@ public class WrapperTest { } @Test - public void testNoSuchMethod() throws Exception { + void testNoSuchMethod() throws Exception { Assertions.assertThrows(NoSuchMethodException.class, () -> { Wrapper w = Wrapper.getWrapper(Object.class); w.invokeMethod(new Object(), "__XX__", null, null); @@ -134,7 +134,7 @@ public class WrapperTest { } @Test - public void testOverloadMethod() throws Exception { + void testOverloadMethod() throws Exception { Wrapper w = Wrapper.getWrapper(I2.class); assertEquals(2, w.getMethodNames().length); @@ -154,7 +154,7 @@ public class WrapperTest { } @Test - public void test_getDeclaredMethodNames_ContainExtendsParentMethods() throws Exception { + void test_getDeclaredMethodNames_ContainExtendsParentMethods() throws Exception { assertArrayEquals(new String[]{"hello",}, Wrapper.getWrapper(Parent1.class).getMethodNames()); assertArrayEquals(new String[]{"hello",}, ClassUtils.getMethodNames(Parent1.class)); @@ -163,13 +163,13 @@ public class WrapperTest { } @Test - public void test_getMethodNames_ContainExtendsParentMethods() throws Exception { + void test_getMethodNames_ContainExtendsParentMethods() throws Exception { assertArrayEquals(new String[]{"hello", "world"}, Wrapper.getWrapper(Son.class).getMethodNames()); assertArrayEquals(new String[]{"hello", "world"}, ClassUtils.getMethodNames(Son.class)); } @Test - public void testWrapImplClass(){ + void testWrapImplClass(){ Wrapper w = Wrapper.getWrapper(Impl0.class); String[] propertyNames = w.getPropertyNames(); @@ -293,4 +293,4 @@ public class WrapperTest { public static class EmptyServiceImpl implements EmptyService { } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/cache/FileCacheStoreFactoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/cache/FileCacheStoreFactoryTest.java index 927501ffce..8a3cb3255a 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/cache/FileCacheStoreFactoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/cache/FileCacheStoreFactoryTest.java @@ -71,4 +71,4 @@ class FileCacheStoreFactoryTest { String directoryPath = path.substring(0, index); return directoryPath; } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/cache/FileCacheStoreTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/cache/FileCacheStoreTest.java index 1c2a878e72..bdfcc3b022 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/cache/FileCacheStoreTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/cache/FileCacheStoreTest.java @@ -75,4 +75,4 @@ class FileCacheStoreTest { return directoryPath; } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/AdaptiveCompilerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/AdaptiveCompilerTest.java index 7e2110ca1e..785ee82b16 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/AdaptiveCompilerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/AdaptiveCompilerTest.java @@ -21,10 +21,10 @@ import org.apache.dubbo.rpc.model.FrameworkModel; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class AdaptiveCompilerTest extends JavaCodeTest { +class AdaptiveCompilerTest extends JavaCodeTest { @Test - public void testAvailableCompiler() throws Exception { + void testAvailableCompiler() throws Exception { AdaptiveCompiler.setDefaultCompiler("jdk"); AdaptiveCompiler compiler = new AdaptiveCompiler(); compiler.setFrameworkModel(FrameworkModel.defaultModel()); @@ -33,4 +33,4 @@ public class AdaptiveCompilerTest extends JavaCodeTest { Assertions.assertEquals("Hello world!", helloService.sayHello()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/ClassUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/ClassUtilsTest.java index 88ddf8fe4d..e2d990caf9 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/ClassUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/ClassUtilsTest.java @@ -25,41 +25,41 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class ClassUtilsTest { +class ClassUtilsTest { @Test - public void testNewInstance() { + void testNewInstance() { HelloServiceImpl0 instance = (HelloServiceImpl0) ClassUtils.newInstance(HelloServiceImpl0.class.getName()); Assertions.assertEquals("Hello world!", instance.sayHello()); } @Test - public void testNewInstance0() { + void testNewInstance0() { Assertions.assertThrows(IllegalStateException.class, () -> ClassUtils.newInstance(PrivateHelloServiceImpl.class.getName())); } @Test - public void testNewInstance1() { + void testNewInstance1() { Assertions.assertThrows(IllegalStateException.class, () -> ClassUtils.newInstance("org.apache.dubbo.common.compiler.support.internal.HelloServiceInternalImpl")); } @Test - public void testNewInstance2() { + void testNewInstance2() { Assertions.assertThrows(IllegalStateException.class, () -> ClassUtils.newInstance("org.apache.dubbo.common.compiler.support.internal.NotExistsImpl")); } @Test - public void testForName() { + void testForName() { ClassUtils.forName(new String[]{"org.apache.dubbo.common.compiler.support"}, "HelloServiceImpl0"); } @Test - public void testForName1() { + void testForName1() { Assertions.assertThrows(IllegalStateException.class, () -> ClassUtils.forName(new String[]{"org.apache.dubbo.common.compiler.support"}, "HelloServiceImplXX")); } @Test - public void testForName2() { + void testForName2() { ClassUtils.forName("boolean"); ClassUtils.forName("byte"); ClassUtils.forName("char"); @@ -79,7 +79,7 @@ public class ClassUtilsTest { } @Test - public void testGetBoxedClass() { + void testGetBoxedClass() { Assertions.assertEquals(Boolean.class, ClassUtils.getBoxedClass(boolean.class)); Assertions.assertEquals(Character.class, ClassUtils.getBoxedClass(char.class)); Assertions.assertEquals(Byte.class, ClassUtils.getBoxedClass(byte.class)); @@ -92,7 +92,7 @@ public class ClassUtilsTest { } @Test - public void testBoxedAndUnboxed() { + void testBoxedAndUnboxed() { Assertions.assertEquals(Boolean.valueOf(true), ClassUtils.boxed(true)); Assertions.assertEquals(Character.valueOf('0'), ClassUtils.boxed('0')); Assertions.assertEquals(Byte.valueOf((byte) 0), ClassUtils.boxed((byte) 0)); @@ -113,7 +113,7 @@ public class ClassUtilsTest { } @Test - public void testGetSize() { + void testGetSize() { Assertions.assertEquals(0, ClassUtils.getSize(null)); List list = new ArrayList<>(); list.add(1); @@ -127,17 +127,17 @@ public class ClassUtilsTest { } @Test - public void testToUri() { + void testToUri() { Assertions.assertThrows(RuntimeException.class, () -> ClassUtils.toURI("#xx_abc#hello")); } @Test - public void testGetSizeMethod() { + void testGetSizeMethod() { Assertions.assertEquals("getLength()", ClassUtils.getSizeMethod(GenericClass3.class)); } @Test - public void testGetSimpleClassName() { + void testGetSimpleClassName() { Assertions.assertNull(ClassUtils.getSimpleClassName(null)); Assertions.assertEquals("Map", ClassUtils.getSimpleClassName(Map.class.getName())); Assertions.assertEquals("Map", ClassUtils.getSimpleClassName(Map.class.getSimpleName())); @@ -174,4 +174,4 @@ public class ClassUtilsTest { } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavaCodeTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavaCodeTest.java index a812a2b8c4..16686cde7f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavaCodeTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavaCodeTest.java @@ -18,7 +18,7 @@ package org.apache.dubbo.common.compiler.support; import java.util.concurrent.atomic.AtomicInteger; -public class JavaCodeTest { +class JavaCodeTest { public final static AtomicInteger SUBFIX = new AtomicInteger(8); @@ -107,4 +107,4 @@ public class JavaCodeTest { code.append('}'); return code.toString(); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavassistCompilerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavassistCompilerTest.java index 66b2e00944..37c60165a7 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavassistCompilerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavassistCompilerTest.java @@ -23,9 +23,9 @@ import org.junit.jupiter.api.condition.JRE; import java.lang.reflect.Method; -public class JavassistCompilerTest extends JavaCodeTest { +class JavassistCompilerTest extends JavaCodeTest { @Test - public void testCompileJavaClass() throws Exception { + void testCompileJavaClass() throws Exception { JavassistCompiler compiler = new JavassistCompiler(); Class clazz = compiler.compile(JavaCodeTest.class, getSimpleCode(), JavassistCompiler.class.getClassLoader()); @@ -55,7 +55,7 @@ public class JavassistCompilerTest extends JavaCodeTest { } @Test - public void testCompileJavaClass1() throws Exception { + void testCompileJavaClass1() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> { JavassistCompiler compiler = new JavassistCompiler(); Class clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithSyntax0(), JavassistCompiler.class.getClassLoader()); @@ -66,7 +66,7 @@ public class JavassistCompilerTest extends JavaCodeTest { } @Test - public void testCompileJavaClassWithImport() throws Exception { + void testCompileJavaClassWithImport() throws Exception { JavassistCompiler compiler = new JavassistCompiler(); Class clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithImports(), JavassistCompiler.class.getClassLoader()); Object instance = clazz.newInstance(); @@ -75,11 +75,11 @@ public class JavassistCompilerTest extends JavaCodeTest { } @Test - public void testCompileJavaClassWithExtends() throws Exception { + void testCompileJavaClassWithExtends() throws Exception { JavassistCompiler compiler = new JavassistCompiler(); Class clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithWithExtends(), JavassistCompiler.class.getClassLoader()); Object instance = clazz.newInstance(); Method sayHello = instance.getClass().getMethod("sayHello"); Assertions.assertEquals("Hello world3!", sayHello.invoke(instance)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JdkCompilerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JdkCompilerTest.java index baa63b2f71..99633b1210 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JdkCompilerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JdkCompilerTest.java @@ -21,10 +21,10 @@ import org.junit.jupiter.api.Test; import java.lang.reflect.Method; -public class JdkCompilerTest extends JavaCodeTest { +class JdkCompilerTest extends JavaCodeTest { @Test - public void test_compileJavaClass() throws Exception { + void test_compileJavaClass() throws Exception { JdkCompiler compiler = new JdkCompiler(); Class clazz = compiler.compile(JavaCodeTest.class, getSimpleCode(), JdkCompiler.class.getClassLoader()); Object instance = clazz.newInstance(); @@ -33,7 +33,7 @@ public class JdkCompilerTest extends JavaCodeTest { } @Test - public void test_compileJavaClass0() throws Exception { + void test_compileJavaClass0() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> { JdkCompiler compiler = new JdkCompiler(); Class clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithoutPackage(), JdkCompiler.class.getClassLoader()); @@ -44,7 +44,7 @@ public class JdkCompilerTest extends JavaCodeTest { } @Test - public void test_compileJavaClass1() throws Exception { + void test_compileJavaClass1() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> { JdkCompiler compiler = new JdkCompiler(); Class clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithSyntax(), JdkCompiler.class.getClassLoader()); @@ -55,7 +55,7 @@ public class JdkCompilerTest extends JavaCodeTest { } @Test - public void test_compileJavaClass_java8() throws Exception { + void test_compileJavaClass_java8() throws Exception { JdkCompiler compiler = new JdkCompiler("1.8"); Class clazz = compiler.compile(JavaCodeTest.class, getSimpleCode(), JdkCompiler.class.getClassLoader()); Object instance = clazz.newInstance(); @@ -64,7 +64,7 @@ public class JdkCompilerTest extends JavaCodeTest { } @Test - public void test_compileJavaClass0_java8() throws Exception { + void test_compileJavaClass0_java8() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> { JdkCompiler compiler = new JdkCompiler("1.8"); Class clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithoutPackage(), JdkCompiler.class.getClassLoader()); @@ -75,7 +75,7 @@ public class JdkCompilerTest extends JavaCodeTest { } @Test - public void test_compileJavaClass1_java8() throws Exception { + void test_compileJavaClass1_java8() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> { JdkCompiler compiler = new JdkCompiler("1.8"); Class clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithSyntax(), JdkCompiler.class.getClassLoader()); @@ -84,4 +84,4 @@ public class JdkCompilerTest extends JavaCodeTest { Assertions.assertEquals("Hello world!", sayHello.invoke(instance)); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/concurrent/CompletableFutureTaskTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/concurrent/CompletableFutureTaskTest.java index 58317dd521..f9f0d60fff 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/concurrent/CompletableFutureTaskTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/concurrent/CompletableFutureTaskTest.java @@ -37,12 +37,12 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -public class CompletableFutureTaskTest { +class CompletableFutureTaskTest { private static final ExecutorService executor = new ThreadPoolExecutor(0, 10, 60L, TimeUnit.SECONDS, new SynchronousQueue(), new NamedThreadFactory("DubboMonitorCreator", true)); @Test - public void testCreate() throws InterruptedException { + void testCreate() throws InterruptedException { final CountDownLatch countDownLatch = new CountDownLatch(1); CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> { @@ -53,7 +53,7 @@ public class CompletableFutureTaskTest { } @Test - public void testRunnableResponse() throws ExecutionException, InterruptedException { + void testRunnableResponse() throws ExecutionException, InterruptedException { CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(500); @@ -68,7 +68,7 @@ public class CompletableFutureTaskTest { } @Test - public void testListener() throws InterruptedException { + void testListener() throws InterruptedException { CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(500); @@ -84,8 +84,8 @@ public class CompletableFutureTaskTest { } -@Test - public void testCustomExecutor() { + @Test + void testCustomExecutor() { Executor mockedExecutor = mock(Executor.class); CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> { return 0; @@ -93,4 +93,4 @@ public class CompletableFutureTaskTest { completableFuture.thenRunAsync(mock(Runnable.class), mockedExecutor).whenComplete((s, e) -> verify(mockedExecutor, times(1)).execute(any(Runnable.class))); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/CompositeConfigurationTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/CompositeConfigurationTest.java index 1022f973cb..09d4ca7fa7 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/CompositeConfigurationTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/CompositeConfigurationTest.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; /** * {@link CompositeConfiguration} */ -public class CompositeConfigurationTest { +class CompositeConfigurationTest { @Test - public void test() { + void test() { InmemoryConfiguration inmemoryConfiguration1 = new InmemoryConfiguration(); InmemoryConfiguration inmemoryConfiguration2 = new InmemoryConfiguration(); InmemoryConfiguration inmemoryConfiguration3 = new InmemoryConfiguration(); @@ -39,4 +39,4 @@ public class CompositeConfigurationTest { Assertions.assertEquals(configuration.getInternalProperty("k"), "v3"); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/ConfigurationCacheTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/ConfigurationCacheTest.java index e4a5aca4c3..acf6a3b229 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/ConfigurationCacheTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/ConfigurationCacheTest.java @@ -22,14 +22,14 @@ import org.junit.jupiter.api.Test; /** * {@link ConfigurationCache} */ -public class ConfigurationCacheTest { +class ConfigurationCacheTest { @Test - public void test() { + void test() { ConfigurationCache configurationCache = new ConfigurationCache(); String value = configurationCache.computeIfAbsent("k1", k -> "v1"); Assertions.assertEquals(value, "v1"); value = configurationCache.computeIfAbsent("k1", k -> "v2"); Assertions.assertEquals(value, "v1"); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/ConfigurationUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/ConfigurationUtilsTest.java index e7d58b619e..da4e01a3f6 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/ConfigurationUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/ConfigurationUtilsTest.java @@ -31,9 +31,9 @@ import static org.apache.dubbo.common.constants.CommonConstants.SHUTDOWN_WAIT_KE /** * */ -public class ConfigurationUtilsTest { +class ConfigurationUtilsTest { @Test - public void testCachedProperties() { + void testCachedProperties() { FrameworkModel frameworkModel = new FrameworkModel(); ApplicationModel applicationModel = new ApplicationModel(frameworkModel); @@ -72,21 +72,21 @@ public class ConfigurationUtilsTest { } @Test - public void testGetServerShutdownTimeout () { + void testGetServerShutdownTimeout () { System.setProperty(SHUTDOWN_WAIT_KEY, " 10000"); Assertions.assertEquals(10000, ConfigurationUtils.getServerShutdownTimeout(ApplicationModel.defaultModel())); System.clearProperty(SHUTDOWN_WAIT_KEY); } @Test - public void testGetProperty () { + void testGetProperty () { System.setProperty(SHUTDOWN_WAIT_KEY, " 10000"); Assertions.assertEquals("10000", ConfigurationUtils.getProperty(ApplicationModel.defaultModel(), SHUTDOWN_WAIT_KEY)); System.clearProperty(SHUTDOWN_WAIT_KEY); } @Test - public void testParseSingleProperties() throws Exception { + void testParseSingleProperties() throws Exception { String p1 = "aaa=bbb"; Map result = ConfigurationUtils.parseProperties(p1); Assertions.assertEquals(1, result.size()); @@ -94,7 +94,7 @@ public class ConfigurationUtilsTest { } @Test - public void testParseMultipleProperties() throws Exception { + void testParseMultipleProperties() throws Exception { String p1 = "aaa=bbb\nccc=ddd"; Map result = ConfigurationUtils.parseProperties(p1); Assertions.assertEquals(2, result.size()); @@ -103,10 +103,10 @@ public class ConfigurationUtilsTest { } @Test - public void testEscapedNewLine() throws Exception { + void testEscapedNewLine() throws Exception { String p1 = "dubbo.registry.address=zookeeper://127.0.0.1:2181\\\\ndubbo.protocol.port=20880"; Map result = ConfigurationUtils.parseProperties(p1); Assertions.assertEquals(1, result.size()); Assertions.assertEquals("zookeeper://127.0.0.1:2181\\ndubbo.protocol.port=20880", result.get("dubbo.registry.address")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentConfigurationTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentConfigurationTest.java index 88c4c47824..b2433a1590 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentConfigurationTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentConfigurationTest.java @@ -29,7 +29,7 @@ import java.util.Map; /** * The type Environment configuration test. */ -public class EnvironmentConfigurationTest { +class EnvironmentConfigurationTest { private static final String MOCK_KEY = "DUBBO_KEY"; private static final String MOCK_VALUE = "mockValue"; @@ -43,7 +43,7 @@ public class EnvironmentConfigurationTest { } @Test - public void testGetInternalProperty() { + void testGetInternalProperty() { Map map = new HashMap<>(); map.put(MOCK_KEY, MOCK_VALUE); try { @@ -101,4 +101,4 @@ public class EnvironmentConfigurationTest { } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentTest.java index cf2235ec5a..01c00fa43e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/EnvironmentTest.java @@ -35,10 +35,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * {@link Environment} */ -public class EnvironmentTest { +class EnvironmentTest { @Test - public void testResolvePlaceholders() { + void testResolvePlaceholders() { Environment environment = ApplicationModel.defaultModel().getModelEnvironment(); Map externalMap = new LinkedHashMap<>(); @@ -62,7 +62,7 @@ public class EnvironmentTest { } @Test - public void test() { + void test() { FrameworkModel frameworkModel = new FrameworkModel(); ApplicationModel applicationModel = new ApplicationModel(frameworkModel); Environment environment = applicationModel.getModelEnvironment(); @@ -112,4 +112,4 @@ public class EnvironmentTest { frameworkModel.destroy(); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/InmemoryConfigurationTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/InmemoryConfigurationTest.java index 3ac7b90300..50c55c00fe 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/InmemoryConfigurationTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/InmemoryConfigurationTest.java @@ -159,4 +159,4 @@ class InmemoryConfigurationTest { } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/OrderedPropertiesConfigurationTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/OrderedPropertiesConfigurationTest.java index 64578bfeb2..45525c7191 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/OrderedPropertiesConfigurationTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/OrderedPropertiesConfigurationTest.java @@ -25,12 +25,12 @@ import org.junit.jupiter.api.Test; /** * {@link OrderedPropertiesConfiguration} */ -public class OrderedPropertiesConfigurationTest { +class OrderedPropertiesConfigurationTest { @Test - public void testOrderPropertiesProviders() { + void testOrderPropertiesProviders() { OrderedPropertiesConfiguration configuration = new OrderedPropertiesConfiguration(ApplicationModel.defaultModel().getDefaultModule()); Assertions.assertEquals("999", configuration.getInternalProperty("testKey")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/PrefixedConfigurationTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/PrefixedConfigurationTest.java index b12a5e2ce9..8f7d89fb0a 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/PrefixedConfigurationTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/PrefixedConfigurationTest.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; import java.util.LinkedHashMap; import java.util.Map; -public class PrefixedConfigurationTest { +class PrefixedConfigurationTest { @Test - public void testPrefixedConfiguration() { + void testPrefixedConfiguration() { Map props = new LinkedHashMap<>(); props.put("dubbo.protocol.name", "dubbo"); props.put("dubbo.protocol.port", "1234"); @@ -48,4 +48,4 @@ public class PrefixedConfigurationTest { Assertions.assertEquals("2345", prefixedConfiguration.getProperty("port")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/PropertiesConfigurationTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/PropertiesConfigurationTest.java index d301f5871b..9394a6cacf 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/PropertiesConfigurationTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/PropertiesConfigurationTest.java @@ -26,10 +26,10 @@ import java.util.Map; /** * {@link PropertiesConfiguration} */ -public class PropertiesConfigurationTest { +class PropertiesConfigurationTest { @Test - public void test() { + void test() { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(ApplicationModel.defaultModel()); Map properties = propertiesConfiguration.getProperties(); @@ -45,4 +45,4 @@ public class PropertiesConfigurationTest { propertiesConfiguration.remove("k1"); Assertions.assertNull(propertiesConfiguration.getProperty("k1")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/SystemConfigurationTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/SystemConfigurationTest.java index 3fea755472..d25f46101c 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/SystemConfigurationTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/SystemConfigurationTest.java @@ -51,7 +51,7 @@ class SystemConfigurationTest { * Test get sys property. */ @Test - public void testGetSysProperty() { + void testGetSysProperty() { Assertions.assertNull(sysConfig.getInternalProperty(MOCK_KEY)); Assertions.assertFalse(sysConfig.containsKey(MOCK_KEY)); Assertions.assertNull(sysConfig.getString(MOCK_KEY)); @@ -67,7 +67,7 @@ class SystemConfigurationTest { * Test convert. */ @Test - public void testConvert() { + void testConvert() { Assertions.assertEquals( MOCK_STRING_VALUE, sysConfig.convert(String.class, NOT_EXIST_KEY, MOCK_STRING_VALUE)); System.setProperty(MOCK_KEY, String.valueOf(MOCK_BOOL_VALUE)); @@ -114,4 +114,4 @@ class SystemConfigurationTest { MockTwo } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/AbstractDynamicConfigurationFactoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/AbstractDynamicConfigurationFactoryTest.java index 7a9536b017..4633dd3ec8 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/AbstractDynamicConfigurationFactoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/AbstractDynamicConfigurationFactoryTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * @see AbstractDynamicConfigurationFactory * @since 2.7.5 */ -public class AbstractDynamicConfigurationFactoryTest { +class AbstractDynamicConfigurationFactoryTest { private AbstractDynamicConfigurationFactory factory; @@ -45,8 +45,8 @@ public class AbstractDynamicConfigurationFactoryTest { } @Test - public void testGetDynamicConfiguration() { + void testGetDynamicConfiguration() { URL url = URL.valueOf("nop://127.0.0.1"); assertEquals(factory.getDynamicConfiguration(url), factory.getDynamicConfiguration(url)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/AbstractDynamicConfigurationTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/AbstractDynamicConfigurationTest.java index c758aaac90..08afb8d05f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/AbstractDynamicConfigurationTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/AbstractDynamicConfigurationTest.java @@ -44,7 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; * * @since 2.7.5 */ -public class AbstractDynamicConfigurationTest { +class AbstractDynamicConfigurationTest { private AbstractDynamicConfiguration configuration; @@ -69,7 +69,7 @@ public class AbstractDynamicConfigurationTest { } @Test - public void testConstants() { + void testConstants() { assertEquals("dubbo.config-center.", PARAM_NAME_PREFIX); assertEquals("dubbo.config-center.workers", DEFAULT_THREAD_POOL_PREFIX); assertEquals("dubbo.config-center.thread-pool.prefix", THREAD_POOL_PREFIX_PARAM_NAME); @@ -84,7 +84,7 @@ public class AbstractDynamicConfigurationTest { } @Test - public void testConstructor() { + void testConstructor() { URL url = URL.valueOf("default://") .addParameter(THREAD_POOL_PREFIX_PARAM_NAME, "test") .addParameter(THREAD_POOL_SIZE_PARAM_NAME, 10) @@ -121,7 +121,7 @@ public class AbstractDynamicConfigurationTest { } @Test - public void testPublishConfig() { + void testPublishConfig() { assertFalse(configuration.publishConfig(null, null)); assertFalse(configuration.publishConfig(null, null, null)); } @@ -132,36 +132,36 @@ public class AbstractDynamicConfigurationTest { // } @Test - public void testGetConfig() { + void testGetConfig() { assertNull(configuration.getConfig(null, null)); assertNull(configuration.getConfig(null, null, 200)); } @Test - public void testGetInternalProperty() { + void testGetInternalProperty() { assertNull(configuration.getInternalProperty(null)); } @Test - public void testGetProperties() { + void testGetProperties() { assertNull(configuration.getProperties(null, null)); assertNull(configuration.getProperties(null, null, 100L)); } @Test - public void testAddListener() { + void testAddListener() { configuration.addListener(null, null); configuration.addListener(null, null, null); } @Test - public void testRemoveListener() { + void testRemoveListener() { configuration.removeListener(null, null); configuration.removeListener(null, null, null); } @Test - public void testClose() throws Exception { + void testClose() throws Exception { configuration.close(); } @@ -172,7 +172,7 @@ public class AbstractDynamicConfigurationTest { * @since 2.7.8 */ @Test - public void testGetGroupAndGetDefaultGroup() { + void testGetGroupAndGetDefaultGroup() { assertEquals(configuration.getGroup(), configuration.getDefaultGroup()); assertEquals(DEFAULT_GROUP, configuration.getDefaultGroup()); } @@ -184,7 +184,7 @@ public class AbstractDynamicConfigurationTest { * @since 2.7.8 */ @Test - public void testGetTimeoutAndGetDefaultTimeout() { + void testGetTimeoutAndGetDefaultTimeout() { assertEquals(configuration.getTimeout(), configuration.getDefaultTimeout()); assertEquals(-1L, configuration.getDefaultTimeout()); } @@ -196,10 +196,10 @@ public class AbstractDynamicConfigurationTest { * @since 2.7.8 */ @Test - public void testRemoveConfigAndDoRemoveConfig() throws Exception { + void testRemoveConfigAndDoRemoveConfig() throws Exception { String key = null; String group = null; assertEquals(configuration.removeConfig(key, group), configuration.doRemoveConfig(key, group)); assertFalse(configuration.removeConfig(key, group)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangeTypeTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangeTypeTest.java index e56e4fbe59..8b3224b13e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangeTypeTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangeTypeTest.java @@ -29,10 +29,10 @@ import static org.junit.jupiter.api.Assertions.assertArrayEquals; * @see ConfigChangeType * @since 2.7.5 */ -public class ConfigChangeTypeTest { +class ConfigChangeTypeTest { @Test - public void testMembers() { + void testMembers() { assertArrayEquals(new ConfigChangeType[]{ADDED, MODIFIED, DELETED}, ConfigChangeType.values()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangedEventTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangedEventTest.java index 7725399ab2..55183f3cd0 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangedEventTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/ConfigChangedEventTest.java @@ -26,7 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; * * @since 2.7.5 */ -public class ConfigChangedEventTest { +class ConfigChangedEventTest { private static final String KEY = "k"; @@ -35,7 +35,7 @@ public class ConfigChangedEventTest { private static final String CONTENT = "c"; @Test - public void testGetter() { + void testGetter() { ConfigChangedEvent event = new ConfigChangedEvent(KEY, GROUP, CONTENT); @@ -55,7 +55,7 @@ public class ConfigChangedEventTest { } @Test - public void testEqualsAndHashCode() { + void testEqualsAndHashCode() { for (ConfigChangeType type : ConfigChangeType.values()) { assertEquals(new ConfigChangedEvent(KEY, GROUP, CONTENT, type), new ConfigChangedEvent(KEY, GROUP, CONTENT, type)); assertEquals(new ConfigChangedEvent(KEY, GROUP, CONTENT, type).hashCode(), new ConfigChangedEvent(KEY, GROUP, CONTENT, type).hashCode()); @@ -64,8 +64,8 @@ public class ConfigChangedEventTest { } @Test - public void testToString() { + void testToString() { ConfigChangedEvent event = new ConfigChangedEvent(KEY, GROUP, CONTENT); assertNotNull(event.toString()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/DynamicConfigurationFactoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/DynamicConfigurationFactoryTest.java index c89091c662..f52b79e328 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/DynamicConfigurationFactoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/DynamicConfigurationFactoryTest.java @@ -28,12 +28,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * * @since 2.7.5 */ -public class DynamicConfigurationFactoryTest { +class DynamicConfigurationFactoryTest { @Test - public void testDefaultExtension() { + void testDefaultExtension() { DynamicConfigurationFactory factory = getExtensionLoader(DynamicConfigurationFactory.class).getDefaultExtension(); assertEquals(NopDynamicConfigurationFactory.class, factory.getClass()); assertEquals(NopDynamicConfigurationFactory.class, getExtensionLoader(DynamicConfigurationFactory.class).getExtension("nop").getClass()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationFactoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationFactoryTest.java index 32430a8b96..37c3f22847 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationFactoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationFactoryTest.java @@ -28,10 +28,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * * @since 2.7.5 */ -public class FileSystemDynamicConfigurationFactoryTest { +class FileSystemDynamicConfigurationFactoryTest { @Test - public void testGetFactory() { + void testGetFactory() { assertEquals(FileSystemDynamicConfigurationFactory.class, ConfigurationUtils.getDynamicConfigurationFactory(ApplicationModel.defaultModel(), "file").getClass()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationTest.java index cb34f71d7a..ae4ec918be 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationTest.java @@ -45,7 +45,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; // Test often failed on GitHub Actions Platform because of file system on Azure // Change to Disabled because DisabledIfEnvironmentVariable does not work on GitHub. @Disabled -public class FileSystemDynamicConfigurationTest { +class FileSystemDynamicConfigurationTest { private final Logger logger = LoggerFactory.getLogger(getClass()); @@ -79,7 +79,7 @@ public class FileSystemDynamicConfigurationTest { } @Test - public void testInit() { + void testInit() { assertEquals(new File(getClassPath(), "config-center"), configuration.getRootDirectory()); assertEquals("UTF-8", configuration.getEncoding()); @@ -95,7 +95,7 @@ public class FileSystemDynamicConfigurationTest { } @Test - public void testPublishAndGetConfig() { + void testPublishAndGetConfig() { assertTrue(configuration.publishConfig(KEY, CONTENT)); assertTrue(configuration.publishConfig(KEY, CONTENT)); assertTrue(configuration.publishConfig(KEY, CONTENT)); @@ -103,7 +103,7 @@ public class FileSystemDynamicConfigurationTest { } @Test - public void testAddAndRemoveListener() throws InterruptedException { + void testAddAndRemoveListener() throws InterruptedException { configuration.publishConfig(KEY, "A"); @@ -160,7 +160,7 @@ public class FileSystemDynamicConfigurationTest { } @Test - public void testRemoveConfig() throws Exception { + void testRemoveConfig() throws Exception { assertTrue(configuration.publishConfig(KEY, DEFAULT_GROUP, "A")); @@ -183,4 +183,4 @@ public class FileSystemDynamicConfigurationTest { // // assertEquals(new TreeSet(asList("A", "B", "C")), configuration.getConfigKeys(DEFAULT_GROUP)); // } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/constants/CommonConstantsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/constants/CommonConstantsTest.java index bc85dfb3d5..7ab68f44b5 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/constants/CommonConstantsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/constants/CommonConstantsTest.java @@ -29,13 +29,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * * @since 2.7.8 */ -public class CommonConstantsTest { +class CommonConstantsTest { @Test - public void test() { + void test() { assertEquals(',', COMMA_SEPARATOR_CHAR); assertEquals("composite", COMPOSITE_METADATA_STORAGE_TYPE); assertEquals("service-name-mapping.properties-path", SERVICE_NAME_MAPPING_PROPERTIES_FILE_KEY); assertEquals("META-INF/dubbo/service-name-mapping.properties", DEFAULT_SERVICE_NAME_MAPPING_PROPERTIES_PATH); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/ConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/ConverterTest.java index ab40833cf3..2deaf7ebb6 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/ConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/ConverterTest.java @@ -31,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertSame; * * @since 2.7.8 */ -public class ConverterTest { +class ConverterTest { private ConverterUtil converterUtil; @@ -46,7 +46,7 @@ public class ConverterTest { } @Test - public void testGetConverter() { + void testGetConverter() { getExtensionLoader(Converter.class) .getSupportedExtensionInstances() .forEach(converter -> { @@ -55,9 +55,9 @@ public class ConverterTest { } @Test - public void testConvertIfPossible() { + void testConvertIfPossible() { assertEquals(Integer.valueOf(2), converterUtil.convertIfPossible("2", Integer.class)); assertEquals(Boolean.FALSE, converterUtil.convertIfPossible("false", Boolean.class)); assertEquals(Double.valueOf(1), converterUtil.convertIfPossible("1", Double.class)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToBooleanConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToBooleanConverterTest.java index e955fa9a41..64dbe23e86 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToBooleanConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToBooleanConverterTest.java @@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToBooleanConverterTest { +class StringToBooleanConverterTest { private StringToBooleanConverter converter; @@ -39,12 +39,12 @@ public class StringToBooleanConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, Boolean.class)); } @Test - public void testConvert() { + void testConvert() { assertTrue(converter.convert("true")); assertTrue(converter.convert("true")); assertTrue(converter.convert("True")); @@ -52,4 +52,4 @@ public class StringToBooleanConverterTest { assertNull(converter.convert("")); assertNull(converter.convert(null)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToCharArrayConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToCharArrayConverterTest.java index bc3a606ee5..e05a315b57 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToCharArrayConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToCharArrayConverterTest.java @@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToCharArrayConverterTest { +class StringToCharArrayConverterTest { private StringToCharArrayConverter converter; @@ -39,13 +39,13 @@ public class StringToCharArrayConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, char[].class)); } @Test - public void testConvert() { + void testConvert() { assertArrayEquals(new char[]{'1', '2', '3'}, converter.convert("123")); assertNull(converter.convert(null)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToCharacterConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToCharacterConverterTest.java index 87f3367709..c5c321397b 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToCharacterConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToCharacterConverterTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToCharacterConverterTest { +class StringToCharacterConverterTest { private StringToCharacterConverter converter; @@ -40,16 +40,16 @@ public class StringToCharacterConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, Character.class)); } @Test - public void testConvert() { + void testConvert() { assertEquals('t', converter.convert("t")); assertNull(converter.convert(null)); assertThrows(IllegalArgumentException.class, () -> { converter.convert("ttt"); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToDoubleConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToDoubleConverterTest.java index 2c74736018..ae92ee6151 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToDoubleConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToDoubleConverterTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToDoubleConverterTest { +class StringToDoubleConverterTest { private StringToDoubleConverter converter; @@ -40,16 +40,16 @@ public class StringToDoubleConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, Double.class)); } @Test - public void testConvert() { + void testConvert() { assertEquals(Double.valueOf("1.0"), converter.convert("1.0")); assertNull(converter.convert(null)); assertThrows(NumberFormatException.class, () -> { converter.convert("ttt"); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToFloatConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToFloatConverterTest.java index b4b36f3f17..794e7ca325 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToFloatConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToFloatConverterTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToFloatConverterTest { +class StringToFloatConverterTest { private StringToFloatConverter converter; @@ -40,16 +40,16 @@ public class StringToFloatConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, Float.class)); } @Test - public void testConvert() { + void testConvert() { assertEquals(Float.valueOf("1.0"), converter.convert("1.0")); assertNull(converter.convert(null)); assertThrows(NumberFormatException.class, () -> { converter.convert("ttt"); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToIntegerConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToIntegerConverterTest.java index 1ccebfd183..5a648d9fe1 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToIntegerConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToIntegerConverterTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToIntegerConverterTest { +class StringToIntegerConverterTest { private StringToIntegerConverter converter; @@ -40,16 +40,16 @@ public class StringToIntegerConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, Integer.class)); } @Test - public void testConvert() { + void testConvert() { assertEquals(Integer.valueOf("1"), converter.convert("1")); assertNull(converter.convert(null)); assertThrows(NumberFormatException.class, () -> { converter.convert("ttt"); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToLongConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToLongConverterTest.java index c7cd926262..cda878d1c5 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToLongConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToLongConverterTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToLongConverterTest { +class StringToLongConverterTest { private StringToLongConverter converter; @@ -40,16 +40,16 @@ public class StringToLongConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, Long.class)); } @Test - public void testConvert() { + void testConvert() { assertEquals(Long.valueOf("1"), converter.convert("1")); assertNull(converter.convert(null)); assertThrows(NumberFormatException.class, () -> { converter.convert("ttt"); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToOptionalConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToOptionalConverterTest.java index 9cb79e20b5..f2edaeac93 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToOptionalConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToOptionalConverterTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToOptionalConverterTest { +class StringToOptionalConverterTest { private StringToOptionalConverter converter; @@ -40,13 +40,13 @@ public class StringToOptionalConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, Optional.class)); } @Test - public void testConvert() { + void testConvert() { assertEquals(Optional.of("1"), converter.convert("1")); assertEquals(Optional.empty(), converter.convert(null)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToShortConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToShortConverterTest.java index 9ecdc207b7..b349d1cef2 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToShortConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToShortConverterTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToShortConverterTest { +class StringToShortConverterTest { private StringToShortConverter converter; @@ -40,16 +40,16 @@ public class StringToShortConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, Short.class)); } @Test - public void testConvert() { + void testConvert() { assertEquals(Short.valueOf("1"), converter.convert("1")); assertNull(converter.convert(null)); assertThrows(NumberFormatException.class, () -> { converter.convert("ttt"); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToStringConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToStringConverterTest.java index 517585df77..aeada364ed 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToStringConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/StringToStringConverterTest.java @@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToStringConverterTest { +class StringToStringConverterTest { private StringToStringConverter converter; @@ -39,13 +39,13 @@ public class StringToStringConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, String.class)); } @Test - public void testConvert() { + void testConvert() { assertEquals("1", converter.convert("1")); assertNull(converter.convert(null)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/MultiValueConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/MultiValueConverterTest.java index ea64628bd2..ac904bbc8f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/MultiValueConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/MultiValueConverterTest.java @@ -35,10 +35,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * * @since 2.7.8 */ -public class MultiValueConverterTest { +class MultiValueConverterTest { @Test - public void testFind() { + void testFind() { MultiValueConverter converter = MultiValueConverter.find(String.class, String[].class); assertEquals(StringToArrayConverter.class, converter.getClass()); @@ -69,4 +69,4 @@ public class MultiValueConverterTest { converter = MultiValueConverter.find(String.class, TransferQueue.class); assertEquals(StringToTransferQueueConverter.class, converter.getClass()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToArrayConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToArrayConverterTest.java index 79bfac3088..0565c290d0 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToArrayConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToArrayConverterTest.java @@ -32,7 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToArrayConverterTest { +class StringToArrayConverterTest { private StringToArrayConverter converter; @@ -42,7 +42,7 @@ public class StringToArrayConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, char[].class)); assertTrue(converter.accept(null, char[].class)); assertFalse(converter.accept(null, String.class)); @@ -51,7 +51,7 @@ public class StringToArrayConverterTest { } @Test - public void testConvert() { + void testConvert() { assertTrue(deepEquals(new Integer[]{123}, converter.convert("123", Integer[].class, Integer.class))); assertTrue(deepEquals(new Integer[]{1, 2, 3}, converter.convert("1,2,3", Integer[].class, null))); assertNull(converter.convert("", Integer[].class, null)); @@ -59,12 +59,12 @@ public class StringToArrayConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToBlockingDequeConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToBlockingDequeConverterTest.java index f0975ad6bf..e114f8b6b9 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToBlockingDequeConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToBlockingDequeConverterTest.java @@ -51,7 +51,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * @see BlockingDeque * @since 2.7.6 */ -public class StringToBlockingDequeConverterTest { +class StringToBlockingDequeConverterTest { private MultiValueConverter converter; @@ -61,7 +61,7 @@ public class StringToBlockingDequeConverterTest { } @Test - public void testAccept() { + void testAccept() { assertFalse(converter.accept(String.class, Collection.class)); @@ -89,7 +89,7 @@ public class StringToBlockingDequeConverterTest { } @Test - public void testConvert() throws NoSuchFieldException { + void testConvert() throws NoSuchFieldException { BlockingQueue values = new LinkedBlockingDeque(asList(1, 2, 3)); @@ -109,12 +109,12 @@ public class StringToBlockingDequeConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE - 5, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToBlockingQueueConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToBlockingQueueConverterTest.java index f1d8cb8b67..2c830782ea 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToBlockingQueueConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToBlockingQueueConverterTest.java @@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * @see BlockingDeque * @since 2.7.6 */ -public class StringToBlockingQueueConverterTest { +class StringToBlockingQueueConverterTest { private MultiValueConverter converter; @@ -60,7 +60,7 @@ public class StringToBlockingQueueConverterTest { } @Test - public void testAccept() { + void testAccept() { assertFalse(converter.accept(String.class, Collection.class)); @@ -88,7 +88,7 @@ public class StringToBlockingQueueConverterTest { } @Test - public void testConvert() { + void testConvert() { BlockingQueue values = new ArrayBlockingQueue(3); values.offer(1); @@ -112,12 +112,12 @@ public class StringToBlockingQueueConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE - 3, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToCollectionConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToCollectionConverterTest.java index 564ece3384..37a3aa145c 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToCollectionConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToCollectionConverterTest.java @@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToCollectionConverterTest { +class StringToCollectionConverterTest { private MultiValueConverter converter; @@ -57,7 +57,7 @@ public class StringToCollectionConverterTest { } @Test - public void testAccept() { + void testAccept() { assertTrue(converter.accept(String.class, Collection.class)); @@ -85,7 +85,7 @@ public class StringToCollectionConverterTest { } @Test - public void testConvert() { + void testConvert() { List values = asList(1L, 2L, 3L); @@ -105,12 +105,12 @@ public class StringToCollectionConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE - 1, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToDequeConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToDequeConverterTest.java index 3d4b785f41..f921cae0f5 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToDequeConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToDequeConverterTest.java @@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToDequeConverterTest { +class StringToDequeConverterTest { private MultiValueConverter converter; @@ -60,7 +60,7 @@ public class StringToDequeConverterTest { } @Test - public void testAccept() { + void testAccept() { assertFalse(converter.accept(String.class, Collection.class)); @@ -88,7 +88,7 @@ public class StringToDequeConverterTest { } @Test - public void testConvert() { + void testConvert() { Deque values = new ArrayDeque(asList(1, 2, 3)); @@ -107,12 +107,12 @@ public class StringToDequeConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE - 3, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToListConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToListConverterTest.java index 4258199e3d..5002449317 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToListConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToListConverterTest.java @@ -49,7 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToListConverterTest { +class StringToListConverterTest { private MultiValueConverter converter; @@ -59,7 +59,7 @@ public class StringToListConverterTest { } @Test - public void testAccept() { + void testAccept() { assertFalse(converter.accept(String.class, Collection.class)); @@ -87,7 +87,7 @@ public class StringToListConverterTest { } @Test - public void testConvert() { + void testConvert() { List values = asList(1, 2, 3); @@ -106,12 +106,12 @@ public class StringToListConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE - 2, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToNavigableSetConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToNavigableSetConverterTest.java index e7e1660d81..bcea5dc4b3 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToNavigableSetConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToNavigableSetConverterTest.java @@ -49,7 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToNavigableSetConverterTest { +class StringToNavigableSetConverterTest { private MultiValueConverter converter; @@ -59,7 +59,7 @@ public class StringToNavigableSetConverterTest { } @Test - public void testAccept() { + void testAccept() { assertFalse(converter.accept(String.class, Collection.class)); @@ -87,7 +87,7 @@ public class StringToNavigableSetConverterTest { } @Test - public void testConvert() { + void testConvert() { Set values = new TreeSet(asList(1, 2, 3)); @@ -106,12 +106,12 @@ public class StringToNavigableSetConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE - 4, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToQueueConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToQueueConverterTest.java index 864b472662..014b069bfe 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToQueueConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToQueueConverterTest.java @@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToQueueConverterTest { +class StringToQueueConverterTest { private StringToQueueConverter converter; @@ -60,7 +60,7 @@ public class StringToQueueConverterTest { } @Test - public void testAccept() { + void testAccept() { assertFalse(converter.accept(String.class, Collection.class)); @@ -88,7 +88,7 @@ public class StringToQueueConverterTest { } @Test - public void testConvert() { + void testConvert() { Queue values = new ArrayDeque(asList(1.0, 2.0, 3.0)); @@ -108,12 +108,12 @@ public class StringToQueueConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE - 2, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToSetConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToSetConverterTest.java index 4cc85e15af..4c1c251ddc 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToSetConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToSetConverterTest.java @@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToSetConverterTest { +class StringToSetConverterTest { private StringToSetConverter converter; @@ -60,7 +60,7 @@ public class StringToSetConverterTest { } @Test - public void testAccept() { + void testAccept() { assertFalse(converter.accept(String.class, Collection.class)); @@ -88,7 +88,7 @@ public class StringToSetConverterTest { } @Test - public void testConvert() { + void testConvert() { Set values = new HashSet(asList(1.0, 2.0, 3.0)); Set result = (Set) converter.convert("1.0,2.0,3.0", Queue.class, Double.class); @@ -107,12 +107,12 @@ public class StringToSetConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE - 2, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToSortedSetConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToSortedSetConverterTest.java index 2ed12526ce..769309ab6e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToSortedSetConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToSortedSetConverterTest.java @@ -49,7 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToSortedSetConverterTest { +class StringToSortedSetConverterTest { private MultiValueConverter converter; @@ -59,7 +59,7 @@ public class StringToSortedSetConverterTest { } @Test - public void testAccept() { + void testAccept() { assertFalse(converter.accept(String.class, Collection.class)); @@ -87,7 +87,7 @@ public class StringToSortedSetConverterTest { } @Test - public void testConvert() { + void testConvert() { Set values = new TreeSet(asList(1, 2, 3)); @@ -106,12 +106,12 @@ public class StringToSortedSetConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE - 3, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToTransferQueueConverterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToTransferQueueConverterTest.java index e4cc101b91..3e46ef1c8c 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToTransferQueueConverterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/convert/multiple/StringToTransferQueueConverterTest.java @@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class StringToTransferQueueConverterTest { +class StringToTransferQueueConverterTest { private MultiValueConverter converter; @@ -60,7 +60,7 @@ public class StringToTransferQueueConverterTest { } @Test - public void testAccept() { + void testAccept() { assertFalse(converter.accept(String.class, Collection.class)); @@ -88,7 +88,7 @@ public class StringToTransferQueueConverterTest { } @Test - public void testConvert() { + void testConvert() { TransferQueue values = new LinkedTransferQueue(asList(1, 2, 3)); @@ -109,12 +109,12 @@ public class StringToTransferQueueConverterTest { } @Test - public void testGetSourceType() { + void testGetSourceType() { assertEquals(String.class, converter.getSourceType()); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Integer.MAX_VALUE - 4, converter.getPriority()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/AdaptiveClassCodeGeneratorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/AdaptiveClassCodeGeneratorTest.java index ee83e821ff..830e612c61 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/AdaptiveClassCodeGeneratorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/AdaptiveClassCodeGeneratorTest.java @@ -34,10 +34,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.5 */ -public class AdaptiveClassCodeGeneratorTest { +class AdaptiveClassCodeGeneratorTest { @Test - public void testGenerate() throws IOException { + void testGenerate() throws IOException { AdaptiveClassCodeGenerator generator = new AdaptiveClassCodeGenerator(HasAdaptiveExt.class, "adaptive"); String value = generator.generate(); URL url = getClass().getResource("/org/apache/dubbo/common/extension/adaptive/HasAdaptiveExt$Adaptive"); @@ -48,4 +48,4 @@ public class AdaptiveClassCodeGeneratorTest { assertTrue(content.contains(value)); } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionDirectorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionDirectorTest.java index 7db538524c..95f9b59d48 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionDirectorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionDirectorTest.java @@ -31,14 +31,14 @@ import org.junit.jupiter.api.Test; import java.util.Collection; -public class ExtensionDirectorTest { +class ExtensionDirectorTest { String testFwSrvName = "testFwSrv"; String testAppSrvName = "testAppSrv"; String testMdSrvName = "testMdSrv"; @Test - public void testInheritanceAndScope() { + void testInheritanceAndScope() { // Expecting: // 1. SPI extension only be created in ExtensionDirector which matched scope @@ -78,12 +78,12 @@ public class ExtensionDirectorTest { } @Test - public void testPostProcessor() { + void testPostProcessor() { } @Test - public void testModelAware() { + void testModelAware() { // Expecting: // 1. Module scope SPI can be injected ModuleModel, ApplicationModel, FrameworkModel // 2. Application scope SPI can be injected ApplicationModel, FrameworkModel, but not ModuleModel @@ -139,7 +139,7 @@ public class ExtensionDirectorTest { } @Test - public void testModelDataIsolation() { + void testModelDataIsolation() { //Model Tree //├─frameworkModel1 //│ ├─applicationModel11 @@ -227,7 +227,7 @@ public class ExtensionDirectorTest { } @Test - public void testInjection() { + void testInjection() { // Expect: // 1. Framework scope extension can be injected to extensions of Framework/Application/Module scope @@ -272,4 +272,4 @@ public class ExtensionDirectorTest { Assertions.assertTrue(appService.isDestroyed()); Assertions.assertTrue(frameworkService.isDestroyed()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoaderTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoaderTest.java index 1894b9ae41..ff62b95ea7 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoaderTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoaderTest.java @@ -97,14 +97,14 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -public class ExtensionLoaderTest { +class ExtensionLoaderTest { private ExtensionLoader getExtensionLoader(Class type) { return ApplicationModel.defaultModel().getExtensionDirector().getExtensionLoader(type); } @Test - public void test_getExtensionLoader_Null() { + void test_getExtensionLoader_Null() { try { getExtensionLoader(null); fail(); @@ -115,7 +115,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getExtensionLoader_NotInterface() { + void test_getExtensionLoader_NotInterface() { try { getExtensionLoader(ExtensionLoaderTest.class); fail(); @@ -126,7 +126,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getExtensionLoader_NotSpiAnnotation() { + void test_getExtensionLoader_NotSpiAnnotation() { try { getExtensionLoader(NoSpiExt.class); fail(); @@ -139,7 +139,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getDefaultExtension() { + void test_getDefaultExtension() { SimpleExt ext = getExtensionLoader(SimpleExt.class).getDefaultExtension(); assertThat(ext, instanceOf(SimpleExtImpl1.class)); @@ -148,7 +148,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getDefaultExtension_NULL() { + void test_getDefaultExtension_NULL() { Ext2 ext = getExtensionLoader(Ext2.class).getDefaultExtension(); assertNull(ext); @@ -157,13 +157,13 @@ public class ExtensionLoaderTest { } @Test - public void test_getExtension() { + void test_getExtension() { assertTrue(getExtensionLoader(SimpleExt.class).getExtension("impl1") instanceof SimpleExtImpl1); assertTrue(getExtensionLoader(SimpleExt.class).getExtension("impl2") instanceof SimpleExtImpl2); } @Test - public void test_getExtension_WithWrapper() { + void test_getExtension_WithWrapper() { WrappedExt impl1 = getExtensionLoader(WrappedExt.class).getExtension("impl1"); assertThat(impl1, anyOf(instanceOf(Ext6Wrapper1.class), instanceOf(Ext6Wrapper2.class))); assertThat(impl1, instanceOf(WrappedExtWrapper.class)); @@ -194,7 +194,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getExtension_withWrapperAnnotation() { + void test_getExtension_withWrapperAnnotation() { WrappedExt impl3 = getExtensionLoader(WrappedExt.class).getExtension("impl3"); assertThat(impl3, instanceOf(Ext6Wrapper3.class)); WrappedExt originImpl3 = impl3; @@ -221,7 +221,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getActivateExtension_WithWrapper() { + void test_getActivateExtension_WithWrapper() { URL url = URL.valueOf("test://localhost/test"); List list = getExtensionLoader(ActivateExt1.class) .getActivateExtension(url, new String[]{}, "order"); @@ -229,7 +229,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getExtension_ExceptionNoExtension() { + void test_getExtension_ExceptionNoExtension() { try { getExtensionLoader(SimpleExt.class).getExtension("XXX"); fail(); @@ -239,7 +239,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getExtension_ExceptionNoExtension_WrapperNotAffactName() { + void test_getExtension_ExceptionNoExtension_WrapperNotAffactName() { try { getExtensionLoader(WrappedExt.class).getExtension("XXX"); fail(); @@ -249,7 +249,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getExtension_ExceptionNullArg() { + void test_getExtension_ExceptionNullArg() { try { getExtensionLoader(SimpleExt.class).getExtension(null); fail(); @@ -259,7 +259,7 @@ public class ExtensionLoaderTest { } @Test - public void test_hasExtension() { + void test_hasExtension() { assertTrue(getExtensionLoader(SimpleExt.class).hasExtension("impl1")); assertFalse(getExtensionLoader(SimpleExt.class).hasExtension("impl1,impl2")); assertFalse(getExtensionLoader(SimpleExt.class).hasExtension("xxx")); @@ -273,7 +273,7 @@ public class ExtensionLoaderTest { } @Test - public void test_hasExtension_wrapperIsNotExt() { + void test_hasExtension_wrapperIsNotExt() { assertTrue(getExtensionLoader(WrappedExt.class).hasExtension("impl1")); assertFalse(getExtensionLoader(WrappedExt.class).hasExtension("impl1,impl2")); assertFalse(getExtensionLoader(WrappedExt.class).hasExtension("xxx")); @@ -289,7 +289,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getSupportedExtensions() { + void test_getSupportedExtensions() { Set exts = getExtensionLoader(SimpleExt.class).getSupportedExtensions(); Set expected = new HashSet(); @@ -301,7 +301,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getSupportedExtensions_wrapperIsNotExt() { + void test_getSupportedExtensions_wrapperIsNotExt() { Set exts = getExtensionLoader(WrappedExt.class).getSupportedExtensions(); Set expected = new HashSet(); @@ -314,7 +314,7 @@ public class ExtensionLoaderTest { } @Test - public void test_AddExtension() { + void test_AddExtension() { try { getExtensionLoader(AddExt1.class).getExtension("Manual1"); fail(); @@ -330,7 +330,7 @@ public class ExtensionLoaderTest { } @Test - public void test_AddExtension_NoExtend() { + void test_AddExtension_NoExtend() { getExtensionLoader(Ext9Empty.class).addExtension("ext9", Ext9EmptyImpl.class); Ext9Empty ext = getExtensionLoader(Ext9Empty.class).getExtension("ext9"); @@ -339,7 +339,7 @@ public class ExtensionLoaderTest { } @Test - public void test_AddExtension_ExceptionWhenExistedExtension() { + void test_AddExtension_ExceptionWhenExistedExtension() { SimpleExt ext = getExtensionLoader(SimpleExt.class).getExtension("impl1"); try { @@ -351,7 +351,7 @@ public class ExtensionLoaderTest { } @Test - public void test_AddExtension_Adaptive() { + void test_AddExtension_Adaptive() { ExtensionLoader loader = getExtensionLoader(AddExt2.class); loader.addExtension(null, AddExt2_ManualAdaptive.class); @@ -360,7 +360,7 @@ public class ExtensionLoaderTest { } @Test - public void test_AddExtension_Adaptive_ExceptionWhenExistedAdaptive() { + void test_AddExtension_Adaptive_ExceptionWhenExistedAdaptive() { ExtensionLoader loader = getExtensionLoader(AddExt1.class); loader.getAdaptiveExtension(); @@ -374,7 +374,7 @@ public class ExtensionLoaderTest { } @Test - public void test_addExtension_with_error_class() { + void test_addExtension_with_error_class() { try { getExtensionLoader(SimpleExt.class).addExtension("impl1", ExtensionLoaderTest.class); } catch (IllegalStateException expected) { @@ -385,7 +385,7 @@ public class ExtensionLoaderTest { } @Test - public void test_addExtension_with_interface() { + void test_addExtension_with_interface() { try { getExtensionLoader(SimpleExt.class).addExtension("impl1", SimpleExt.class); } catch (IllegalStateException expected) { @@ -396,7 +396,7 @@ public class ExtensionLoaderTest { } @Test - public void test_addExtension_without_adaptive_annotation() { + void test_addExtension_without_adaptive_annotation() { try { getExtensionLoader(NoAdaptiveExt.class).addExtension(null, NoAdaptiveExtImpl.class); } catch (IllegalStateException expected) { @@ -407,7 +407,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getLoadedExtension_name_with_null() { + void test_getLoadedExtension_name_with_null() { try { getExtensionLoader(SimpleExt.class).getLoadedExtension(null); } catch (IllegalArgumentException expected) { @@ -416,13 +416,13 @@ public class ExtensionLoaderTest { } @Test - public void test_getLoadedExtension_null() { + void test_getLoadedExtension_null() { SimpleExt impl1 = getExtensionLoader(SimpleExt.class).getLoadedExtension("XXX"); assertNull(impl1); } @Test - public void test_getLoadedExtension() { + void test_getLoadedExtension() { SimpleExt simpleExt = getExtensionLoader(SimpleExt.class).getExtension("impl1"); assertThat(simpleExt, instanceOf(SimpleExtImpl1.class)); @@ -431,7 +431,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getLoadedExtensions() { + void test_getLoadedExtensions() { SimpleExt simpleExt1 = getExtensionLoader(SimpleExt.class).getExtension("impl1"); assertThat(simpleExt1, instanceOf(SimpleExtImpl1.class)); @@ -443,7 +443,7 @@ public class ExtensionLoaderTest { } @Test - public void test_getLoadedExtensionInstances() { + void test_getLoadedExtensionInstances() { SimpleExt simpleExt1 = getExtensionLoader(SimpleExt.class).getExtension("impl1"); assertThat(simpleExt1, instanceOf(SimpleExtImpl1.class)); @@ -455,7 +455,7 @@ public class ExtensionLoaderTest { } @Test - public void test_replaceExtension_with_error_class() { + void test_replaceExtension_with_error_class() { try { getExtensionLoader(SimpleExt.class).replaceExtension("impl1", ExtensionLoaderTest.class); } catch (IllegalStateException expected) { @@ -466,7 +466,7 @@ public class ExtensionLoaderTest { } @Test - public void test_replaceExtension_with_interface() { + void test_replaceExtension_with_interface() { try { getExtensionLoader(SimpleExt.class).replaceExtension("impl1", SimpleExt.class); } catch (IllegalStateException expected) { @@ -477,7 +477,7 @@ public class ExtensionLoaderTest { } @Test - public void test_replaceExtension() { + void test_replaceExtension() { try { getExtensionLoader(AddExt1.class).getExtension("Manual2"); fail(); @@ -501,7 +501,7 @@ public class ExtensionLoaderTest { } @Test - public void test_replaceExtension_Adaptive() { + void test_replaceExtension_Adaptive() { ExtensionLoader loader = getExtensionLoader(AddExt3.class); AddExt3 adaptive = loader.getAdaptiveExtension(); @@ -514,7 +514,7 @@ public class ExtensionLoaderTest { } @Test - public void test_replaceExtension_ExceptionWhenNotExistedExtension() { + void test_replaceExtension_ExceptionWhenNotExistedExtension() { AddExt1 ext = getExtensionLoader(AddExt1.class).getExtension("impl1"); try { @@ -526,7 +526,7 @@ public class ExtensionLoaderTest { } @Test - public void test_replaceExtension_Adaptive_ExceptionWhenNotExistedExtension() { + void test_replaceExtension_Adaptive_ExceptionWhenNotExistedExtension() { ExtensionLoader loader = getExtensionLoader(AddExt4.class); try { @@ -538,7 +538,7 @@ public class ExtensionLoaderTest { } @Test - public void test_InitError() { + void test_InitError() { ExtensionLoader loader = getExtensionLoader(InitErrorExt.class); loader.getExtension("ok"); @@ -553,7 +553,7 @@ public class ExtensionLoaderTest { } @Test - public void testLoadActivateExtension() { + void testLoadActivateExtension() { // test default URL url = URL.valueOf("test://localhost/test"); List list = getExtensionLoader(ActivateExt1.class) @@ -596,7 +596,7 @@ public class ExtensionLoaderTest { } @Test - public void testLoadDefaultActivateExtension() { + void testLoadDefaultActivateExtension() { // test default URL url = URL.valueOf("test://localhost/test?ext=order1,default"); List list = getExtensionLoader(ActivateExt1.class) @@ -621,7 +621,7 @@ public class ExtensionLoaderTest { } @Test - public void testInjectExtension() { + void testInjectExtension() { // register bean for test ScopeBeanExtensionInjector DemoImpl demoBean = new DemoImpl(); ApplicationModel.defaultModel().getBeanFactory().registerBean(demoBean); @@ -647,7 +647,7 @@ public class ExtensionLoaderTest { } @Test - public void testGetOrDefaultExtension() { + void testGetOrDefaultExtension() { ExtensionLoader loader = getExtensionLoader(InjectExt.class); InjectExt injectExt = loader.getOrDefaultExtension("non-exists"); assertEquals(InjectExtImpl.class, injectExt.getClass()); @@ -655,7 +655,7 @@ public class ExtensionLoaderTest { } @Test - public void testGetSupported() { + void testGetSupported() { ExtensionLoader loader = getExtensionLoader(InjectExt.class); assertEquals(1, loader.getSupportedExtensions().size()); assertEquals(Collections.singleton("injection"), loader.getSupportedExtensions()); @@ -665,7 +665,7 @@ public class ExtensionLoaderTest { * @since 2.7.7 */ @Test - public void testOverridden() { + void testOverridden() { ExtensionLoader loader = getExtensionLoader(Converter.class); Converter converter = loader.getExtension("string-to-boolean"); @@ -691,7 +691,7 @@ public class ExtensionLoaderTest { * @since 2.7.7 */ @Test - public void testGetLoadingStrategies() { + void testGetLoadingStrategies() { List strategies = getLoadingStrategies(); assertEquals(4, strategies.size()); @@ -717,7 +717,7 @@ public class ExtensionLoaderTest { } @Test - public void testDuplicatedImplWithoutOverriddenStrategy() { + void testDuplicatedImplWithoutOverriddenStrategy() { List loadingStrategies = ExtensionLoader.getLoadingStrategies(); ExtensionLoader.setLoadingStrategies(new DubboExternalLoadingStrategyTest(false), new DubboInternalLoadingStrategyTest(false)); @@ -735,7 +735,7 @@ public class ExtensionLoaderTest { } @Test - public void testDuplicatedImplWithOverriddenStrategy() { + void testDuplicatedImplWithOverriddenStrategy() { List loadingStrategies = ExtensionLoader.getLoadingStrategies(); ExtensionLoader.setLoadingStrategies(new DubboExternalLoadingStrategyTest(true), new DubboInternalLoadingStrategyTest(true)); @@ -747,7 +747,7 @@ public class ExtensionLoaderTest { } @Test - public void testLoadByDubboInternalSPI() { + void testLoadByDubboInternalSPI() { ExtensionLoader extensionLoader = getExtensionLoader(SPI1.class); SPI1 spi1 = extensionLoader.getExtension("1",true); assertNotNull(spi1); @@ -832,4 +832,4 @@ public class ExtensionLoaderTest { return MAX_PRIORITY; } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_Test.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_Test.java index 047d0e288c..52755a8bf4 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_Test.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_Test.java @@ -44,17 +44,17 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -public class ExtensionLoader_Adaptive_Test { +class ExtensionLoader_Adaptive_Test { @Test - public void test_useAdaptiveClass() throws Exception { + void test_useAdaptiveClass() throws Exception { ExtensionLoader loader = ExtensionLoader.getExtensionLoader(HasAdaptiveExt.class); HasAdaptiveExt ext = loader.getAdaptiveExtension(); assertTrue(ext instanceof HasAdaptiveExt_ManualAdaptive); } @Test - public void test_getAdaptiveExtension_defaultAdaptiveKey() throws Exception { + void test_getAdaptiveExtension_defaultAdaptiveKey() throws Exception { { SimpleExt ext = ExtensionLoader.getExtensionLoader(SimpleExt.class).getAdaptiveExtension(); @@ -78,7 +78,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_getAdaptiveExtension_customizeAdaptiveKey() throws Exception { + void test_getAdaptiveExtension_customizeAdaptiveKey() throws Exception { SimpleExt ext = ExtensionLoader.getExtensionLoader(SimpleExt.class).getAdaptiveExtension(); Map map = new HashMap(); @@ -94,7 +94,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_getAdaptiveExtension_protocolKey() throws Exception { + void test_getAdaptiveExtension_protocolKey() throws Exception { UseProtocolKeyExt ext = ExtensionLoader.getExtensionLoader(UseProtocolKeyExt.class).getAdaptiveExtension(); { @@ -130,7 +130,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_getAdaptiveExtension_UrlNpe() throws Exception { + void test_getAdaptiveExtension_UrlNpe() throws Exception { SimpleExt ext = ExtensionLoader.getExtensionLoader(SimpleExt.class).getAdaptiveExtension(); try { @@ -142,7 +142,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_getAdaptiveExtension_ExceptionWhenNoAdaptiveMethodOnInterface() throws Exception { + void test_getAdaptiveExtension_ExceptionWhenNoAdaptiveMethodOnInterface() throws Exception { try { ExtensionLoader.getExtensionLoader(NoAdaptiveMethodExt.class).getAdaptiveExtension(); fail(); @@ -163,7 +163,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_getAdaptiveExtension_ExceptionWhenNotAdaptiveMethod() throws Exception { + void test_getAdaptiveExtension_ExceptionWhenNotAdaptiveMethod() throws Exception { SimpleExt ext = ExtensionLoader.getExtensionLoader(SimpleExt.class).getAdaptiveExtension(); Map map = new HashMap(); @@ -181,7 +181,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_getAdaptiveExtension_ExceptionWhenNoUrlAttribute() throws Exception { + void test_getAdaptiveExtension_ExceptionWhenNoUrlAttribute() throws Exception { try { ExtensionLoader.getExtensionLoader(NoUrlParamExt.class).getAdaptiveExtension(); fail(); @@ -192,7 +192,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_urlHolder_getAdaptiveExtension() throws Exception { + void test_urlHolder_getAdaptiveExtension() throws Exception { Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension(); Map map = new HashMap(); @@ -207,7 +207,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_urlHolder_getAdaptiveExtension_noExtension() throws Exception { + void test_urlHolder_getAdaptiveExtension_noExtension() throws Exception { Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension(); URL url = new ServiceConfigURL("p1", "1.2.3.4", 1010, "path1"); @@ -233,7 +233,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_urlHolder_getAdaptiveExtension_UrlNpe() throws Exception { + void test_urlHolder_getAdaptiveExtension_UrlNpe() throws Exception { Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension(); try { @@ -252,7 +252,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_urlHolder_getAdaptiveExtension_ExceptionWhenNotAdativeMethod() throws Exception { + void test_urlHolder_getAdaptiveExtension_ExceptionWhenNotAdativeMethod() throws Exception { Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension(); Map map = new HashMap(); @@ -270,7 +270,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_urlHolder_getAdaptiveExtension_ExceptionWhenNameNotProvided() throws Exception { + void test_urlHolder_getAdaptiveExtension_ExceptionWhenNameNotProvided() throws Exception { Ext2 ext = ExtensionLoader.getExtensionLoader(Ext2.class).getAdaptiveExtension(); URL url = new ServiceConfigURL("p1", "1.2.3.4", 1010, "path1"); @@ -296,7 +296,7 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_getAdaptiveExtension_inject() throws Exception { + void test_getAdaptiveExtension_inject() throws Exception { LogUtil.start(); Ext6 ext = ExtensionLoader.getExtensionLoader(Ext6.class).getAdaptiveExtension(); @@ -314,10 +314,10 @@ public class ExtensionLoader_Adaptive_Test { } @Test - public void test_getAdaptiveExtension_InjectNotExtFail() throws Exception { + void test_getAdaptiveExtension_InjectNotExtFail() throws Exception { Ext6 ext = ExtensionLoader.getExtensionLoader(Ext6.class).getExtension("impl2"); Ext6Impl2 impl = (Ext6Impl2) ext; assertNull(impl.getList()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java index f311555793..0848c01a43 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java @@ -21,7 +21,7 @@ import org.apache.dubbo.common.compiler.support.AdaptiveCompiler; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -public class ExtensionLoader_Adaptive_UseJdkCompiler_Test extends ExtensionLoader_Adaptive_Test { +class ExtensionLoader_Adaptive_UseJdkCompiler_Test extends ExtensionLoader_Adaptive_Test { @BeforeAll public static void setUp() throws Exception { AdaptiveCompiler.setDefaultCompiler("jdk"); @@ -31,4 +31,4 @@ public class ExtensionLoader_Adaptive_UseJdkCompiler_Test extends ExtensionLoade public static void tearDown() throws Exception { AdaptiveCompiler.setDefaultCompiler("javassist"); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Compatible_Test.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Compatible_Test.java index 97904ae1c9..967215037f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Compatible_Test.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Compatible_Test.java @@ -24,11 +24,11 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ExtensionLoader_Compatible_Test { +class ExtensionLoader_Compatible_Test { @Test - public void test_getExtension() throws Exception { + void test_getExtension() throws Exception { assertTrue(ExtensionLoader.getExtensionLoader(CompatibleExt.class).getExtension("impl1") instanceof CompatibleExtImpl1); assertTrue(ExtensionLoader.getExtensionLoader(CompatibleExt.class).getExtension("impl2") instanceof CompatibleExtImpl2); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/inject/AdaptiveExtensionInjectorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/inject/AdaptiveExtensionInjectorTest.java index d533f20258..566ffa4787 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/inject/AdaptiveExtensionInjectorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/inject/AdaptiveExtensionInjectorTest.java @@ -31,10 +31,10 @@ import org.junit.jupiter.api.Test; * {@link ScopeBeanExtensionInjector} * {@link SpiExtensionInjector} */ -public class AdaptiveExtensionInjectorTest { +class AdaptiveExtensionInjectorTest { @Test - public void test() { + void test() { FrameworkModel frameworkModel = new FrameworkModel(); ExtensionLoader extensionLoader = frameworkModel.getExtensionLoader(ExtensionInjector.class); @@ -56,4 +56,4 @@ public class AdaptiveExtensionInjectorTest { frameworkModel.destroy(); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/ActivateComparatorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/ActivateComparatorTest.java index 29d8b1c611..2b0bbad296 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/ActivateComparatorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/ActivateComparatorTest.java @@ -26,7 +26,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class ActivateComparatorTest { +class ActivateComparatorTest { private ActivateComparator activateComparator; @@ -36,7 +36,7 @@ public class ActivateComparatorTest { } @Test - public void testActivateComparator(){ + void testActivateComparator(){ Filter1 f1 = new Filter1(); Filter2 f2 = new Filter2(); Filter3 f3 = new Filter3(); @@ -59,7 +59,7 @@ public class ActivateComparatorTest { } @Test - public void testFilterOrder() { + void testFilterOrder() { Order0Filter1 order0Filter1 = new Order0Filter1(); Order0Filter2 order0Filter2 = new Order0Filter2(); @@ -83,4 +83,4 @@ public class ActivateComparatorTest { Assertions.assertEquals(order0Filter2.getClass(), filters.get(1)); } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/wrapper/WrapperTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/wrapper/WrapperTest.java index a6f1a56e8f..f17543d1c4 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/wrapper/WrapperTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/wrapper/WrapperTest.java @@ -29,13 +29,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.5 */ -public class WrapperTest { +class WrapperTest { @Test - public void testWrapper() { + void testWrapper() { Demo demoWrapper = ExtensionLoader.getExtensionLoader(Demo.class).getExtension("demo"); assertTrue(demoWrapper instanceof DemoWrapper); Demo demoWrapper2 = ExtensionLoader.getExtensionLoader(Demo.class).getExtension("demo2"); assertTrue(demoWrapper2 instanceof DemoWrapper2); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/function/PredicatesTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/function/PredicatesTest.java index d042e645b7..b1dc5de727 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/function/PredicatesTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/function/PredicatesTest.java @@ -30,20 +30,20 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.5 */ -public class PredicatesTest { +class PredicatesTest { @Test - public void testAlwaysTrue() { + void testAlwaysTrue() { assertTrue(alwaysTrue().test(null)); } @Test - public void testAlwaysFalse() { + void testAlwaysFalse() { assertFalse(alwaysFalse().test(null)); } @Test - public void testAnd() { + void testAnd() { assertTrue(and(alwaysTrue(), alwaysTrue(), alwaysTrue()).test(null)); assertFalse(and(alwaysFalse(), alwaysFalse(), alwaysFalse()).test(null)); assertFalse(and(alwaysTrue(), alwaysFalse(), alwaysFalse()).test(null)); @@ -51,10 +51,10 @@ public class PredicatesTest { } @Test - public void testOr() { + void testOr() { assertTrue(or(alwaysTrue(), alwaysTrue(), alwaysTrue()).test(null)); assertTrue(or(alwaysTrue(), alwaysTrue(), alwaysFalse()).test(null)); assertTrue(or(alwaysTrue(), alwaysFalse(), alwaysFalse()).test(null)); assertFalse(or(alwaysFalse(), alwaysFalse(), alwaysFalse()).test(null)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/function/StreamsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/function/StreamsTest.java index d55a009155..d8fde23d22 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/function/StreamsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/function/StreamsTest.java @@ -35,23 +35,23 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * * @since 2.7.5 */ -public class StreamsTest { +class StreamsTest { @Test - public void testFilterStream() { + void testFilterStream() { Stream stream = filterStream(asList(1, 2, 3, 4, 5), i -> i % 2 == 0); assertEquals(asList(2, 4), stream.collect(toList())); } @Test - public void testFilterList() { + void testFilterList() { List list = filterList(asList(1, 2, 3, 4, 5), i -> i % 2 == 0); assertEquals(asList(2, 4), list); } @Test - public void testFilterSet() { + void testFilterSet() { Set set = filterSet(asList(1, 2, 3, 4, 5), i -> i % 2 == 0); assertEquals(new LinkedHashSet<>(asList(2, 4)), set); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableActionTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableActionTest.java index c5abf14754..5a608eb3ea 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableActionTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableActionTest.java @@ -26,12 +26,12 @@ import static org.apache.dubbo.common.function.ThrowableAction.execute; * * @since 2.7.5 */ -public class ThrowableActionTest { +class ThrowableActionTest { @Test - public void testExecute() { + void testExecute() { Assertions.assertThrows(RuntimeException.class, () -> execute(() -> { throw new Exception("Test"); }), "Test"); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableConsumerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableConsumerTest.java index 0891a5200a..57e515eef0 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableConsumerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableConsumerTest.java @@ -26,12 +26,12 @@ import static org.junit.jupiter.api.Assertions.assertThrows; * * @since 2.7.5 */ -public class ThrowableConsumerTest { +class ThrowableConsumerTest { @Test - public void testExecute() { + void testExecute() { assertThrows(RuntimeException.class, () -> execute("Hello,World", m -> { throw new Exception(m); }), "Hello,World"); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableFunctionTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableFunctionTest.java index 8ddaf271c6..08b9d72a31 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableFunctionTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/function/ThrowableFunctionTest.java @@ -26,12 +26,12 @@ import static org.junit.jupiter.api.Assertions.assertThrows; * * @since 2.7.5 */ -public class ThrowableFunctionTest { +class ThrowableFunctionTest { @Test - public void testExecute() { + void testExecute() { assertThrows(RuntimeException.class, () -> execute("Hello,World", m -> { throw new Exception(m); }), "Hello,World"); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/io/BytesTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/io/BytesTest.java index f065164d98..b57e1cb1c3 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/io/BytesTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/io/BytesTest.java @@ -25,14 +25,14 @@ import java.io.IOException; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -public class BytesTest { +class BytesTest { private final byte[] b1 = "adpfioha;eoh;aldfadl;kfadslkfdajfio123431241235123davas;odvwe;lmzcoqpwoewqogineopwqihwqetup\n\tejqf;lajsfd中文字符0da0gsaofdsf==adfasdfs".getBytes(); private final String C64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; //default base64. private byte[] bytes1 = {3, 12, 14, 41, 12, 2, 3, 12, 4, 67, 23}; private byte[] bytes2 = {3, 12, 14, 41, 12, 2, 3, 12, 4, 67}; @Test - public void testMain() throws Exception { + void testMain() throws Exception { short s = (short) 0xabcd; assertThat(s, is(Bytes.bytes2short(Bytes.short2bytes(s)))); @@ -66,27 +66,27 @@ public class BytesTest { } @Test - public void testWrongBase64Code() { + void testWrongBase64Code() { Assertions.assertThrows(IllegalArgumentException.class, () -> Bytes.bytes2base64("dubbo".getBytes(), 0, 1, new char[]{'a'})); } @Test - public void testWrongOffSet() { + void testWrongOffSet() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> Bytes.bytes2base64("dubbo".getBytes(), -1, 1)); } @Test - public void testLargeLength() { + void testLargeLength() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> Bytes.bytes2base64("dubbo".getBytes(), 0, 100000)); } @Test - public void testSmallLength() { + void testSmallLength() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> Bytes.bytes2base64("dubbo".getBytes(), 0, -1)); } @Test - public void testBase64S2b2sFailCaseLog() throws Exception { + void testBase64S2b2sFailCaseLog() throws Exception { String s1 = Bytes.bytes2base64(bytes1); byte[] out1 = Bytes.base642bytes(s1); assertThat(bytes1, is(out1)); @@ -97,7 +97,7 @@ public class BytesTest { } @Test - public void testBase642bCharArrCall() { + void testBase642bCharArrCall() { byte[] stringCall = Bytes.base642bytes("ZHViYm8=", C64); byte[] charArrCall = Bytes.base642bytes("ZHViYm8=", C64.toCharArray()); @@ -105,25 +105,25 @@ public class BytesTest { } @Test - public void testHex() { + void testHex() { String str = Bytes.bytes2hex(b1); assertThat(b1, is(Bytes.hex2bytes(str))); } @Test - public void testMD5ForString() { + void testMD5ForString() { byte[] md5 = Bytes.getMD5("dubbo"); assertThat(md5, is(Bytes.base642bytes("qk4bjCzJ3u2W/gEu8uB1Kg=="))); } @Test - public void testMD5ForFile() throws IOException { + void testMD5ForFile() throws IOException { byte[] md5 = Bytes.getMD5(new File(getClass().getClassLoader().getResource("md5.testfile.txt").getFile())); assertThat(md5, is(Bytes.base642bytes("iNZ+5qHafVNPLJxHwLKJ3w=="))); } @Test - public void testZip() throws IOException { + void testZip() throws IOException { String s = "hello world"; byte[] zip = Bytes.zip(s.getBytes()); byte[] unzip = Bytes.unzip(zip); @@ -131,12 +131,12 @@ public class BytesTest { } @Test - public void testBytes2HexWithWrongOffset() { + void testBytes2HexWithWrongOffset() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> Bytes.bytes2hex("hello".getBytes(), -1, 1)); } @Test - public void testBytes2HexWithWrongLength() { + void testBytes2HexWithWrongLength() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> Bytes.bytes2hex("hello".getBytes(), 0, 6)); } @@ -161,4 +161,4 @@ public class BytesTest { bb[7] = (byte) (x >> 0); return bb; } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/io/StreamUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/io/StreamUtilsTest.java index 79ac29e493..21c63cc488 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/io/StreamUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/io/StreamUtilsTest.java @@ -28,10 +28,10 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -public class StreamUtilsTest { +class StreamUtilsTest { @Test - public void testMarkSupportedInputStream() throws Exception { + void testMarkSupportedInputStream() throws Exception { InputStream is = StreamUtilsTest.class.getResourceAsStream("/StreamUtilsTest.txt"); assertEquals(10, is.available()); @@ -85,7 +85,7 @@ public class StreamUtilsTest { } @Test - public void testLimitedInputStream() throws Exception { + void testLimitedInputStream() throws Exception { InputStream is = StreamUtilsTest.class.getResourceAsStream("/StreamUtilsTest.txt"); assertThat(10, is(is.available())); @@ -119,7 +119,7 @@ public class StreamUtilsTest { } @Test - public void testMarkInputSupport() { + void testMarkInputSupport() { Assertions.assertThrows(IOException.class, () -> { InputStream is = StreamUtilsTest.class.getResourceAsStream("/StreamUtilsTest.txt"); try { @@ -140,7 +140,7 @@ public class StreamUtilsTest { } @Test - public void testSkipForOriginMarkSupportInput() throws IOException { + void testSkipForOriginMarkSupportInput() throws IOException { InputStream is = StreamUtilsTest.class.getResourceAsStream("/StreamUtilsTest.txt"); InputStream newIs = StreamUtils.markSupportedInputStream(is, 1); @@ -149,7 +149,7 @@ public class StreamUtilsTest { } @Test - public void testReadEmptyByteArray() { + void testReadEmptyByteArray() { Assertions.assertThrows(NullPointerException.class, () -> { InputStream is = StreamUtilsTest.class.getResourceAsStream("/StreamUtilsTest.txt"); try { @@ -164,7 +164,7 @@ public class StreamUtilsTest { } @Test - public void testReadWithWrongOffset() { + void testReadWithWrongOffset() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { InputStream is = StreamUtilsTest.class.getResourceAsStream("/StreamUtilsTest.txt"); try { @@ -177,4 +177,4 @@ public class StreamUtilsTest { } }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayInputStreamTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayInputStreamTest.java index 9603b4c3d3..a60a6af585 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayInputStreamTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayInputStreamTest.java @@ -24,9 +24,9 @@ import java.io.IOException; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -public class UnsafeByteArrayInputStreamTest { +class UnsafeByteArrayInputStreamTest { @Test - public void testMark() { + void testMark() { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes(), 1); assertThat(stream.markSupported(), is(true)); @@ -38,7 +38,7 @@ public class UnsafeByteArrayInputStreamTest { } @Test - public void testRead() throws IOException { + void testRead() throws IOException { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes()); assertThat(stream.read(), is((int) 'a')); assertThat(stream.available(), is(2)); @@ -60,7 +60,7 @@ public class UnsafeByteArrayInputStreamTest { } @Test - public void testWrongLength() { + void testWrongLength() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes()); stream.read(new byte[1], 0, 100); @@ -68,7 +68,7 @@ public class UnsafeByteArrayInputStreamTest { } @Test - public void testWrongOffset() { + void testWrongOffset() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes()); stream.read(new byte[1], -1, 1); @@ -76,7 +76,7 @@ public class UnsafeByteArrayInputStreamTest { } @Test - public void testReadEmptyByteArray() { + void testReadEmptyByteArray() { Assertions.assertThrows(NullPointerException.class, () -> { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes()); stream.read(null, 0, 1); @@ -84,11 +84,11 @@ public class UnsafeByteArrayInputStreamTest { } @Test - public void testSkipZero() { + void testSkipZero() { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes()); long skip = stream.skip(-1); assertThat(skip, is(0L)); assertThat(stream.position(), is(0)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java index dde47f1338..ad733e017f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java @@ -31,14 +31,14 @@ import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; -public class UnsafeByteArrayOutputStreamTest { +class UnsafeByteArrayOutputStreamTest { @Test - public void testWrongSize() { + void testWrongSize() { Assertions.assertThrows(IllegalArgumentException.class, () -> new UnsafeByteArrayOutputStream(-1)); } @Test - public void testWrite() { + void testWrite() { UnsafeByteArrayOutputStream outputStream = new UnsafeByteArrayOutputStream(1); outputStream.write((int) 'a'); outputStream.write("bc".getBytes(), 0, 2); @@ -48,7 +48,7 @@ public class UnsafeByteArrayOutputStreamTest { } @Test - public void testToByteBuffer() { + void testToByteBuffer() { UnsafeByteArrayOutputStream outputStream = new UnsafeByteArrayOutputStream(1); outputStream.write((int) 'a'); @@ -57,7 +57,7 @@ public class UnsafeByteArrayOutputStreamTest { } @Test - public void testExtendLengthForBuffer() throws IOException { + void testExtendLengthForBuffer() throws IOException { UnsafeByteArrayOutputStream outputStream = new UnsafeByteArrayOutputStream(1); for (int i = 0; i < 10; i++) { outputStream.write(i); @@ -70,10 +70,10 @@ public class UnsafeByteArrayOutputStreamTest { } @Test - public void testToStringWithCharset() throws IOException { + void testToStringWithCharset() throws IOException { UnsafeByteArrayOutputStream outputStream = new UnsafeByteArrayOutputStream(); outputStream.write("Hòa Bình".getBytes()); assertThat(outputStream.toString("UTF-8"), is("Hòa Bình")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeStringReaderTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeStringReaderTest.java index ae7a2984e2..2911c64bfa 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeStringReaderTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeStringReaderTest.java @@ -24,9 +24,9 @@ import java.io.IOException; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -public class UnsafeStringReaderTest { +class UnsafeStringReaderTest { @Test - public void testRead() throws IOException { + void testRead() throws IOException { UnsafeStringReader reader = new UnsafeStringReader("abc"); assertThat(reader.markSupported(), is(true)); assertThat(reader.read(), is((int) 'a')); @@ -47,7 +47,7 @@ public class UnsafeStringReaderTest { } @Test - public void testSkip() throws IOException { + void testSkip() throws IOException { UnsafeStringReader reader = new UnsafeStringReader("abc"); assertThat(reader.ready(), is(true)); reader.skip(1); @@ -55,7 +55,7 @@ public class UnsafeStringReaderTest { } @Test - public void testSkipTooLong() throws IOException { + void testSkipTooLong() throws IOException { UnsafeStringReader reader = new UnsafeStringReader("abc"); reader.skip(10); @@ -65,11 +65,11 @@ public class UnsafeStringReaderTest { } @Test - public void testWrongLength() throws IOException { + void testWrongLength() throws IOException { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { UnsafeStringReader reader = new UnsafeStringReader("abc"); char[] chars = new char[1]; reader.read(chars, 0, 2); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeStringWriterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeStringWriterTest.java index 3f4c0c81c2..bb054b3e50 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeStringWriterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeStringWriterTest.java @@ -24,9 +24,9 @@ import java.io.IOException; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -public class UnsafeStringWriterTest { +class UnsafeStringWriterTest { @Test - public void testWrite() { + void testWrite() { UnsafeStringWriter writer = new UnsafeStringWriter(); writer.write("a"); writer.write("abc", 1, 1); @@ -38,12 +38,12 @@ public class UnsafeStringWriterTest { } @Test - public void testNegativeSize() { + void testNegativeSize() { Assertions.assertThrows(IllegalArgumentException.class, () -> new UnsafeStringWriter(-1)); } @Test - public void testAppend() { + void testAppend() { UnsafeStringWriter writer = new UnsafeStringWriter(); writer.append('a'); writer.append("abc", 1, 2); @@ -55,7 +55,7 @@ public class UnsafeStringWriterTest { } @Test - public void testAppendNull() { + void testAppendNull() { UnsafeStringWriter writer = new UnsafeStringWriter(); writer.append(null); writer.append(null, 0, 4); @@ -66,7 +66,7 @@ public class UnsafeStringWriterTest { } @Test - public void testWriteNull() throws IOException { + void testWriteNull() throws IOException { UnsafeStringWriter writer = new UnsafeStringWriter(3); char[] chars = new char[2]; chars[0] = 'a'; @@ -80,7 +80,7 @@ public class UnsafeStringWriterTest { } @Test - public void testWriteCharWithWrongLength() throws IOException { + void testWriteCharWithWrongLength() throws IOException { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { UnsafeStringWriter writer = new UnsafeStringWriter(); char[] chars = new char[0]; @@ -89,11 +89,11 @@ public class UnsafeStringWriterTest { } @Test - public void testWriteCharWithWrongCombineLength() throws IOException { + void testWriteCharWithWrongCombineLength() throws IOException { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { UnsafeStringWriter writer = new UnsafeStringWriter(); char[] chars = new char[1]; writer.write(chars, 1, 1); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/json/GsonUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/json/GsonUtilsTest.java index e6a3e1d6cd..468374d6ba 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/json/GsonUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/json/GsonUtilsTest.java @@ -23,9 +23,9 @@ import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicReference; -public class GsonUtilsTest { +class GsonUtilsTest { @Test - public void test1() { + void test1() { Object user = GsonUtils.fromJson("{'name':'Tom','age':24}", User.class); Assertions.assertInstanceOf(User.class, user); Assertions.assertEquals("Tom", ((User) user).getName()); @@ -40,7 +40,7 @@ public class GsonUtilsTest { } @Test - public void test2() { + void test2() { ClassLoader originClassLoader = Thread.currentThread().getContextClassLoader(); AtomicReference> removedPackages = new AtomicReference<>(Collections.emptyList()); ClassLoader newClassLoader = new ClassLoader(originClassLoader) { @@ -90,4 +90,4 @@ public class GsonUtilsTest { this.age = age; } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/lang/PrioritizedTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/lang/PrioritizedTest.java index 87d28dc579..c65de4d736 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/lang/PrioritizedTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/lang/PrioritizedTest.java @@ -31,22 +31,22 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * * @since 2.7.5 */ -public class PrioritizedTest { +class PrioritizedTest { @Test - public void testConstants() { + void testConstants() { assertEquals(Integer.MAX_VALUE, Prioritized.MIN_PRIORITY); assertEquals(Integer.MIN_VALUE, Prioritized.MAX_PRIORITY); } @Test - public void testGetPriority() { + void testGetPriority() { assertEquals(Prioritized.NORMAL_PRIORITY, new Prioritized() { }.getPriority()); } @Test - public void testComparator() { + void testComparator() { List list = new LinkedList<>(); @@ -123,4 +123,4 @@ public class PrioritizedTest { return Objects.hash(value); } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/lang/ShutdownHookCallbacksTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/lang/ShutdownHookCallbacksTest.java index 19906258f6..035f118172 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/lang/ShutdownHookCallbacksTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/lang/ShutdownHookCallbacksTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.5 */ -public class ShutdownHookCallbacksTest { +class ShutdownHookCallbacksTest { private ShutdownHookCallbacks callbacks; @@ -40,12 +40,12 @@ public class ShutdownHookCallbacksTest { } @Test - public void testSingleton() { + void testSingleton() { assertNotNull(callbacks); } @Test - public void testCallback() { + void testCallback() { callbacks.callback(); DefaultShutdownHookCallback callback = (DefaultShutdownHookCallback) callbacks.getCallbacks().iterator().next(); assertTrue(callback.isExecuted()); @@ -56,4 +56,4 @@ public class ShutdownHookCallbacksTest { callbacks.destroy(); assertTrue(callbacks.getCallbacks().isEmpty()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerAdapterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerAdapterTest.java index 0a9686ff64..7d5b82f840 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerAdapterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerAdapterTest.java @@ -36,7 +36,7 @@ import java.util.stream.Stream; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -public class LoggerAdapterTest { +class LoggerAdapterTest { static Stream data() { return Stream.of( Arguments.of(JclLoggerAdapter.class, JclLogger.class), @@ -68,4 +68,4 @@ public class LoggerAdapterTest { assertThat(loggerAdapter.getLevel(), is(targetLevel)); } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerFactoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerFactoryTest.java index 70a7ce8693..4b5dc7d9e4 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerFactoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerFactoryTest.java @@ -26,9 +26,9 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; -public class LoggerFactoryTest { +class LoggerFactoryTest { @Test - public void testLoggerLevel() { + void testLoggerLevel() { LoggerFactory.setLevel(Level.INFO); Level level = LoggerFactory.getLevel(); @@ -36,7 +36,7 @@ public class LoggerFactoryTest { } @Test - public void testGetLogFile() { + void testGetLogFile() { LoggerFactory.setLoggerAdapter(FrameworkModel.defaultModel(), "slf4j"); File file = LoggerFactory.getFile(); @@ -44,7 +44,7 @@ public class LoggerFactoryTest { } @Test - public void testAllLogLevel() { + void testAllLogLevel() { for (Level targetLevel : Level.values()) { LoggerFactory.setLevel(targetLevel); Level level = LoggerFactory.getLevel(); @@ -54,7 +54,7 @@ public class LoggerFactoryTest { } @Test - public void testGetLogger() { + void testGetLogger() { Logger logger1 = LoggerFactory.getLogger(this.getClass()); Logger logger2 = LoggerFactory.getLogger(this.getClass()); @@ -62,7 +62,7 @@ public class LoggerFactoryTest { } @Test - public void shouldReturnSameLogger() { + void shouldReturnSameLogger() { Logger logger1 = LoggerFactory.getLogger(this.getClass().getName()); Logger logger2 = LoggerFactory.getLogger(this.getClass().getName()); @@ -70,10 +70,10 @@ public class LoggerFactoryTest { } @Test - public void shouldReturnSameErrorTypeAwareLogger() { + void shouldReturnSameErrorTypeAwareLogger() { ErrorTypeAwareLogger logger1 = LoggerFactory.getErrorTypeAwareLogger(this.getClass().getName()); ErrorTypeAwareLogger logger2 = LoggerFactory.getErrorTypeAwareLogger(this.getClass().getName()); assertThat(logger1, is(logger2)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerTest.java index 6e6cd3c676..98941fe686 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/LoggerTest.java @@ -33,7 +33,7 @@ import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; -public class LoggerTest { +class LoggerTest { static Stream data() { return Stream.of( @@ -82,4 +82,4 @@ public class LoggerTest { assertThat(logger.isInfoEnabled(), not(nullValue())); assertThat(logger.isDebugEnabled(), not(nullValue())); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/slf4j/Slf4jLoggerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/slf4j/Slf4jLoggerTest.java index 17d01d9f27..931e34313e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/slf4j/Slf4jLoggerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/slf4j/Slf4jLoggerTest.java @@ -17,21 +17,19 @@ package org.apache.dubbo.common.logger.slf4j; import org.junit.jupiter.api.Test; -import org.slf4j.Marker; import org.slf4j.spi.LocationAwareLogger; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.isNotNull; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.internal.verification.VerificationModeFactory.times; -public class Slf4jLoggerTest { +class Slf4jLoggerTest { @Test - public void testLocationAwareLogger() { + void testLocationAwareLogger() { LocationAwareLogger locationAwareLogger = mock(LocationAwareLogger.class); Slf4jLogger logger = new Slf4jLogger(locationAwareLogger); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/support/FailsafeErrorTypeAwareLoggerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/support/FailsafeErrorTypeAwareLoggerTest.java index ce101f9c30..78c20457dc 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/support/FailsafeErrorTypeAwareLoggerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/support/FailsafeErrorTypeAwareLoggerTest.java @@ -34,9 +34,9 @@ import static org.mockito.Mockito.verify; /** * Tests for FailsafeErrorTypeAwareLogger to test whether it 'ignores' exceptions thrown by logger or not. */ -public class FailsafeErrorTypeAwareLoggerTest { +class FailsafeErrorTypeAwareLoggerTest { @Test - public void testFailsafeErrorTypeAwareForLoggingMethod() { + void testFailsafeErrorTypeAwareForLoggingMethod() { Logger failLogger = mock(Logger.class); FailsafeErrorTypeAwareLogger failsafeLogger = new FailsafeErrorTypeAwareLogger(failLogger); @@ -60,7 +60,7 @@ public class FailsafeErrorTypeAwareLoggerTest { } @Test - public void testSuccessLogger() { + void testSuccessLogger() { Logger successLogger = mock(Logger.class); FailsafeErrorTypeAwareLogger failsafeLogger = new FailsafeErrorTypeAwareLogger(successLogger); @@ -75,7 +75,7 @@ public class FailsafeErrorTypeAwareLoggerTest { } @Test - public void testGetLogger() { + void testGetLogger() { Assertions.assertThrows(RuntimeException.class, () -> { Logger failLogger = mock(Logger.class); FailsafeErrorTypeAwareLogger failsafeLogger = new FailsafeErrorTypeAwareLogger(failLogger); @@ -86,7 +86,7 @@ public class FailsafeErrorTypeAwareLoggerTest { } @Test - public void testInstructionShownOrNot() { + void testInstructionShownOrNot() { LoggerFactory.setLoggerAdapter(FrameworkModel.defaultModel(), "jdk"); ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(FailsafeErrorTypeAwareLoggerTest.class); @@ -97,4 +97,4 @@ public class FailsafeErrorTypeAwareLoggerTest { logger.error(REGISTRY_ADDRESS_INVALID, "Registry center", "May be it's offline.", "error message", new Exception("error")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/support/FailsafeLoggerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/support/FailsafeLoggerTest.java index 841c68eb7a..52abadc0c7 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/logger/support/FailsafeLoggerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/logger/support/FailsafeLoggerTest.java @@ -27,9 +27,9 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -public class FailsafeLoggerTest { +class FailsafeLoggerTest { @Test - public void testFailSafeForLoggingMethod() { + void testFailSafeForLoggingMethod() { Logger failLogger = mock(Logger.class); FailsafeLogger failsafeLogger = new FailsafeLogger(failLogger); @@ -65,7 +65,7 @@ public class FailsafeLoggerTest { } @Test - public void testSuccessLogger() { + void testSuccessLogger() { Logger successLogger = mock(Logger.class); FailsafeLogger failsafeLogger = new FailsafeLogger(successLogger); failsafeLogger.error("error"); @@ -94,7 +94,7 @@ public class FailsafeLoggerTest { } @Test - public void testGetLogger() { + void testGetLogger() { Assertions.assertThrows(RuntimeException.class, () -> { Logger failLogger = mock(Logger.class); FailsafeLogger failsafeLogger = new FailsafeLogger(failLogger); @@ -103,4 +103,4 @@ public class FailsafeLoggerTest { failsafeLogger.getLogger().error("should get error"); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/collector/DefaultMetricsCollectorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/collector/DefaultMetricsCollectorTest.java index 1a5334a8cb..d1c5b20d69 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/collector/DefaultMetricsCollectorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/collector/DefaultMetricsCollectorTest.java @@ -42,7 +42,7 @@ import static org.apache.dubbo.common.constants.MetricsConstants.TAG_INTERFACE_K import static org.apache.dubbo.common.constants.MetricsConstants.TAG_METHOD_KEY; import static org.apache.dubbo.common.constants.MetricsConstants.TAG_VERSION_KEY; -public class DefaultMetricsCollectorTest { +class DefaultMetricsCollectorTest { private ApplicationModel applicationModel; private String interfaceName; @@ -70,7 +70,7 @@ public class DefaultMetricsCollectorTest { } @Test - public void testRequestsMetrics() { + void testRequestsMetrics() { DefaultMetricsCollector collector = new DefaultMetricsCollector(applicationModel); collector.setCollectEnabled(true); collector.increaseTotalRequests(interfaceName, methodName, group, version); @@ -103,7 +103,7 @@ public class DefaultMetricsCollectorTest { } @Test - public void testRTMetrics() { + void testRTMetrics() { DefaultMetricsCollector collector = new DefaultMetricsCollector(applicationModel); collector.setCollectEnabled(true); collector.addRT(interfaceName, methodName, group, version, 10L); @@ -132,7 +132,7 @@ public class DefaultMetricsCollectorTest { } @Test - public void testListener() { + void testListener() { DefaultMetricsCollector collector = new DefaultMetricsCollector(applicationModel); collector.setCollectEnabled(true); @@ -162,4 +162,4 @@ public class DefaultMetricsCollectorTest { return curEvent; } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/event/RTEventTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/event/RTEventTest.java index fea3e0ecec..948110971d 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/event/RTEventTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/event/RTEventTest.java @@ -18,13 +18,14 @@ package org.apache.dubbo.common.metrics.event; import org.apache.dubbo.common.metrics.model.MethodMetric; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class RTEventTest { +class RTEventTest { @Test - public void testNewEvent() { + void testNewEvent() { MethodMetric metric = new MethodMetric(); Long rt = 5L; RTEvent event = new RTEvent(metric, rt); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/event/RequestEventTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/event/RequestEventTest.java index 3da2f3ac5c..b808fa75ec 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/event/RequestEventTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/event/RequestEventTest.java @@ -18,13 +18,14 @@ package org.apache.dubbo.common.metrics.event; import org.apache.dubbo.common.metrics.model.MethodMetric; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class RequestEventTest { +class RequestEventTest { @Test - public void testNewEvent() { + void testNewEvent() { MethodMetric metric = new MethodMetric(); RequestEvent.Type type = RequestEvent.Type.TOTAL; RequestEvent event = new RequestEvent(metric, type); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/MethodMetricTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/MethodMetricTest.java index f4dbcf2ded..b722970950 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/MethodMetricTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/MethodMetricTest.java @@ -23,11 +23,17 @@ import org.junit.jupiter.api.Test; import java.util.Map; -import static org.apache.dubbo.common.constants.MetricsConstants.*; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_APPLICATION_NAME; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_GROUP_KEY; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_HOSTNAME; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_INTERFACE_KEY; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_IP; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_METHOD_KEY; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_VERSION_KEY; import static org.apache.dubbo.common.utils.NetUtils.getLocalHost; import static org.apache.dubbo.common.utils.NetUtils.getLocalHostName; -public class MethodMetricTest { +class MethodMetricTest { private static final String applicationName = null; private static String interfaceName; @@ -44,7 +50,7 @@ public class MethodMetricTest { } @Test - public void test() { + void test() { MethodMetric metric = new MethodMetric(applicationName, interfaceName, methodName, group, version); Assertions.assertEquals(metric.getInterfaceName(), interfaceName); Assertions.assertEquals(metric.getMethodName(), methodName); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/sample/GaugeMetricSampleTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/sample/GaugeMetricSampleTest.java index d45ee03c11..a47e071cf5 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/sample/GaugeMetricSampleTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/sample/GaugeMetricSampleTest.java @@ -18,6 +18,7 @@ package org.apache.dubbo.common.metrics.model.sample; import org.apache.dubbo.common.metrics.model.MetricsCategory; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -26,7 +27,7 @@ import java.util.HashMap; import java.util.Map; import java.util.function.Supplier; -public class GaugeMetricSampleTest { +class GaugeMetricSampleTest { private static String name; private static String description; @@ -46,7 +47,7 @@ public class GaugeMetricSampleTest { } @Test - public void test() { + void test() { GaugeMetricSample sample = new GaugeMetricSample(name, description, tags, category, baseUnit, supplier); Assertions.assertEquals(sample.getName(), name); Assertions.assertEquals(sample.getDescription(), description); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/sample/MetricSampleTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/sample/MetricSampleTest.java index 78b575304a..b85afec10d 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/sample/MetricSampleTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/model/sample/MetricSampleTest.java @@ -18,6 +18,7 @@ package org.apache.dubbo.common.metrics.model.sample; import org.apache.dubbo.common.metrics.model.MetricsCategory; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -25,7 +26,7 @@ import org.junit.jupiter.api.Test; import java.util.HashMap; import java.util.Map; -public class MetricSampleTest { +class MetricSampleTest { private static String name; private static String description; @@ -45,7 +46,7 @@ public class MetricSampleTest { } @Test - public void test() { + void test() { MetricSample sample = new MetricSample(name, description, tags, type, category, baseUnit); Assertions.assertEquals(sample.getName(), name); Assertions.assertEquals(sample.getDescription(), description); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/service/MetricsEntityTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/service/MetricsEntityTest.java index c2688cefce..b6e2016291 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/service/MetricsEntityTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/metrics/service/MetricsEntityTest.java @@ -18,6 +18,7 @@ package org.apache.dubbo.common.metrics.service; import org.apache.dubbo.common.metrics.model.MetricsCategory; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -25,7 +26,7 @@ import org.junit.jupiter.api.Test; import java.util.HashMap; import java.util.Map; -public class MetricsEntityTest { +class MetricsEntityTest { private static String name; private static Map tags; @@ -41,7 +42,7 @@ public class MetricsEntityTest { } @Test - public void test() { + void test() { MetricsEntity entity = new MetricsEntity(name, tags, category, value); Assertions.assertEquals(entity.getName(), name); Assertions.assertEquals(entity.getTags(), tags); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/profiler/ProfilerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/profiler/ProfilerTest.java index d235264482..42c52f8519 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/profiler/ProfilerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/profiler/ProfilerTest.java @@ -19,10 +19,10 @@ package org.apache.dubbo.common.profiler; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ProfilerTest { +class ProfilerTest { @Test - public void testProfiler() { + void testProfiler() { ProfilerEntry one = Profiler.start("1"); ProfilerEntry two = Profiler.enter(one, "1-2"); @@ -79,7 +79,7 @@ public class ProfilerTest { } @Test - public void testBizProfiler() { + void testBizProfiler() { Assertions.assertNull(Profiler.getBizProfiler()); ProfilerEntry one = Profiler.start("1"); @@ -94,4 +94,4 @@ public class ProfilerTest { Profiler.removeBizProfiler(); Assertions.assertNull(Profiler.getBizProfiler()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/resource/GlobalResourcesRepositoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/resource/GlobalResourcesRepositoryTest.java index 28ce084a55..c19a21b65f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/resource/GlobalResourcesRepositoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/resource/GlobalResourcesRepositoryTest.java @@ -24,10 +24,10 @@ import java.util.concurrent.ExecutorService; /** * {@link GlobalResourcesRepository} */ -public class GlobalResourcesRepositoryTest { +class GlobalResourcesRepositoryTest { @Test - public void test() throws NoSuchFieldException { + void test() throws NoSuchFieldException { GlobalResourcesRepository repository = GlobalResourcesRepository.getInstance(); ExecutorService globalExecutorService = GlobalResourcesRepository.getGlobalExecutorService(); @@ -74,4 +74,4 @@ public class GlobalResourcesRepositoryTest { return destroyed; } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/status/StatusTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/status/StatusTest.java index 02a4c4ee2f..188b9692b0 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/status/StatusTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/status/StatusTest.java @@ -25,9 +25,9 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.isEmptyOrNullString; -public class StatusTest { +class StatusTest { @Test - public void testConstructor1() throws Exception { + void testConstructor1() throws Exception { Status status = new Status(OK, "message", "description"); assertThat(status.getLevel(), is(OK)); assertThat(status.getMessage(), equalTo("message")); @@ -35,7 +35,7 @@ public class StatusTest { } @Test - public void testConstructor2() throws Exception { + void testConstructor2() throws Exception { Status status = new Status(OK, "message"); assertThat(status.getLevel(), is(OK)); assertThat(status.getMessage(), equalTo("message")); @@ -43,10 +43,10 @@ public class StatusTest { } @Test - public void testConstructor3() throws Exception { + void testConstructor3() throws Exception { Status status = new Status(OK); assertThat(status.getLevel(), is(OK)); assertThat(status.getMessage(), isEmptyOrNullString()); assertThat(status.getDescription(), isEmptyOrNullString()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/status/reporter/FrameworkStatusReportServiceTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/status/reporter/FrameworkStatusReportServiceTest.java index 14c8465132..1892be1f84 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/status/reporter/FrameworkStatusReportServiceTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/status/reporter/FrameworkStatusReportServiceTest.java @@ -36,10 +36,10 @@ import static org.apache.dubbo.common.status.reporter.FrameworkStatusReportServi /** * {@link FrameworkStatusReportService} */ -public class FrameworkStatusReportServiceTest { +class FrameworkStatusReportServiceTest { @Test - public void test() { + void test() { FrameworkModel frameworkModel = new FrameworkModel(); ApplicationModel applicationModel = new ApplicationModel(frameworkModel); ApplicationConfig app = new ApplicationConfig("APP"); @@ -103,4 +103,4 @@ public class FrameworkStatusReportServiceTest { frameworkModel.destroy(); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/LoadStatusCheckerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/LoadStatusCheckerTest.java index 3361ee3b44..ebf87859b6 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/LoadStatusCheckerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/LoadStatusCheckerTest.java @@ -26,15 +26,15 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.notNullValue; -public class LoadStatusCheckerTest { +class LoadStatusCheckerTest { private static Logger logger = LoggerFactory.getLogger(LoadStatusCheckerTest.class); @Test - public void test() throws Exception { + void test() throws Exception { LoadStatusChecker statusChecker = new LoadStatusChecker(); Status status = statusChecker.check(); assertThat(status, notNullValue()); logger.info("load status level: " + status.getLevel()); logger.info("load status message: " + status.getMessage()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/MemoryStatusCheckerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/MemoryStatusCheckerTest.java index e04b8d70ac..ca624a9cd8 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/MemoryStatusCheckerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/MemoryStatusCheckerTest.java @@ -29,15 +29,15 @@ import static org.hamcrest.CoreMatchers.anyOf; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -public class MemoryStatusCheckerTest { +class MemoryStatusCheckerTest { private static final Logger logger = LoggerFactory.getLogger(MemoryStatusCheckerTest.class); @Test - public void test() throws Exception { + void test() throws Exception { MemoryStatusChecker statusChecker = new MemoryStatusChecker(); Status status = statusChecker.check(); assertThat(status.getLevel(), anyOf(is(OK), is(WARN))); logger.info("memory status level: " + status.getLevel()); logger.info("memory status message: " + status.getMessage()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/StatusUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/StatusUtilsTest.java index 9d6d059d38..d5c3b39e18 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/StatusUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/status/support/StatusUtilsTest.java @@ -30,9 +30,9 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.isEmptyOrNullString; import static org.hamcrest.Matchers.not; -public class StatusUtilsTest { +class StatusUtilsTest { @Test - public void testGetSummaryStatus1() throws Exception { + void testGetSummaryStatus1() throws Exception { Status status1 = new Status(Status.Level.ERROR); Status status2 = new Status(Status.Level.WARN); Status status3 = new Status(Status.Level.OK); @@ -48,7 +48,7 @@ public class StatusUtilsTest { } @Test - public void testGetSummaryStatus2() throws Exception { + void testGetSummaryStatus2() throws Exception { Status status1 = new Status(Status.Level.WARN); Status status2 = new Status(Status.Level.OK); Map statuses = new HashMap(); @@ -61,7 +61,7 @@ public class StatusUtilsTest { } @Test - public void testGetSummaryStatus3() throws Exception { + void testGetSummaryStatus3() throws Exception { Status status1 = new Status(Status.Level.OK); Map statuses = new HashMap(); statuses.put("status1", status1); @@ -69,4 +69,4 @@ public class StatusUtilsTest { assertThat(status.getLevel(), is(Status.Level.OK)); assertThat(status.getMessage(), isEmptyOrNullString()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/store/support/SimpleDataStoreTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/store/support/SimpleDataStoreTest.java index fc99859d47..7b9e7ca225 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/store/support/SimpleDataStoreTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/store/support/SimpleDataStoreTest.java @@ -25,11 +25,11 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SimpleDataStoreTest { +class SimpleDataStoreTest { private SimpleDataStore dataStore = new SimpleDataStore(); @Test - public void testPutGet() throws Exception { + void testPutGet() throws Exception { assertNull(dataStore.get("xxx", "yyy")); dataStore.put("name", "key", "1"); @@ -39,7 +39,7 @@ public class SimpleDataStoreTest { } @Test - public void testRemove() throws Exception { + void testRemove() throws Exception { dataStore.remove("xxx", "yyy"); dataStore.put("name", "key", "1"); @@ -48,7 +48,7 @@ public class SimpleDataStoreTest { } @Test - public void testGetComponent() throws Exception { + void testGetComponent() throws Exception { Map map = dataStore.get("component"); assertTrue(map != null && map.isEmpty()); dataStore.put("component", "key", "value"); @@ -57,4 +57,4 @@ public class SimpleDataStoreTest { dataStore.remove("component", "key"); assertNotEquals(map, dataStore.get("component")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadlocal/InternalThreadLocalTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadlocal/InternalThreadLocalTest.java index 002354afea..5f9d57237b 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadlocal/InternalThreadLocalTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadlocal/InternalThreadLocalTest.java @@ -34,7 +34,7 @@ import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -public class InternalThreadLocalTest { +class InternalThreadLocalTest { private static final int THREADS = 10; @@ -48,7 +48,7 @@ public class InternalThreadLocalTest { } @Test - public void testInternalThreadLocal() throws InterruptedException { + void testInternalThreadLocal() throws InterruptedException { final AtomicInteger index = new AtomicInteger(0); final InternalThreadLocal internalThreadLocal = new InternalThreadLocal() { @@ -70,7 +70,7 @@ public class InternalThreadLocalTest { } @Test - public void testRemoveAll() throws InterruptedException { + void testRemoveAll() throws InterruptedException { final InternalThreadLocal internalThreadLocal = new InternalThreadLocal(); internalThreadLocal.set(1); Assertions.assertEquals(1, (int)internalThreadLocal.get(), "set failed"); @@ -85,7 +85,7 @@ public class InternalThreadLocalTest { } @Test - public void testSize() throws InterruptedException { + void testSize() throws InterruptedException { final InternalThreadLocal internalThreadLocal = new InternalThreadLocal(); internalThreadLocal.set(1); Assertions.assertEquals(1, InternalThreadLocal.size(), "size method is wrong!"); @@ -97,7 +97,7 @@ public class InternalThreadLocalTest { } @Test - public void testSetAndGet() { + void testSetAndGet() { final Integer testVal = 10; final InternalThreadLocal internalThreadLocal = new InternalThreadLocal(); internalThreadLocal.set(testVal); @@ -105,7 +105,7 @@ public class InternalThreadLocalTest { } @Test - public void testRemove() { + void testRemove() { final InternalThreadLocal internalThreadLocal = new InternalThreadLocal(); internalThreadLocal.set(1); Assertions.assertEquals(1, (int)internalThreadLocal.get(), "get method false!"); @@ -115,7 +115,7 @@ public class InternalThreadLocalTest { } @Test - public void testOnRemove() { + void testOnRemove() { final Integer[] valueToRemove = {null}; final InternalThreadLocal internalThreadLocal = new InternalThreadLocal() { @Override @@ -132,7 +132,7 @@ public class InternalThreadLocalTest { } @Test - public void testMultiThreadSetAndGet() throws InterruptedException { + void testMultiThreadSetAndGet() throws InterruptedException { final Integer testVal1 = 10; final Integer testVal2 = 20; final InternalThreadLocal internalThreadLocal = new InternalThreadLocal(); @@ -167,7 +167,7 @@ public class InternalThreadLocalTest { * This test is based on a Machine with 4 core and 16g memory. */ @Test - public void testPerformanceTradition() { + void testPerformanceTradition() { final ThreadLocal[] caches1 = new ThreadLocal[PERFORMANCE_THREAD_COUNT]; final Thread mainThread = Thread.currentThread(); for (int i = 0; i < PERFORMANCE_THREAD_COUNT; i++) { @@ -202,7 +202,7 @@ public class InternalThreadLocalTest { * This test is based on a Machine with 4 core and 16g memory. */ @Test - public void testPerformance() { + void testPerformance() { final InternalThreadLocal[] caches = new InternalThreadLocal[PERFORMANCE_THREAD_COUNT]; final Thread mainThread = Thread.currentThread(); for (int i = 0; i < PERFORMANCE_THREAD_COUNT; i++) { @@ -231,7 +231,7 @@ public class InternalThreadLocalTest { } @Test - public void testConstructionWithIndex() throws Exception { + void testConstructionWithIndex() throws Exception { int ARRAY_LIST_CAPACITY_MAX_SIZE = Integer.MAX_VALUE - 8; Field nextIndexField = InternalThreadLocalMap.class.getDeclaredField("NEXT_INDEX"); @@ -260,7 +260,7 @@ public class InternalThreadLocalTest { } @Test - public void testInternalThreadLocalMapExpand() throws Exception { + void testInternalThreadLocalMapExpand() throws Exception { final AtomicReference throwable = new AtomicReference(); Runnable runnable = new Runnable() { @Override @@ -279,4 +279,4 @@ public class InternalThreadLocalTest { // Assert the expanded size is not overflowed to negative value assertThat(throwable.get(), is(not(instanceOf(NegativeArraySizeException.class)))); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadlocal/NamedInternalThreadFactoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadlocal/NamedInternalThreadFactoryTest.java index 06b072356f..92cd977a3b 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadlocal/NamedInternalThreadFactoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadlocal/NamedInternalThreadFactoryTest.java @@ -20,10 +20,10 @@ package org.apache.dubbo.common.threadlocal; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class NamedInternalThreadFactoryTest { +class NamedInternalThreadFactoryTest { @Test - public void newThread() throws Exception { + void newThread() throws Exception { NamedInternalThreadFactory namedInternalThreadFactory = new NamedInternalThreadFactory(); Thread t = namedInternalThreadFactory.newThread(new Runnable() { @Override @@ -33,4 +33,4 @@ public class NamedInternalThreadFactoryTest { }); Assertions.assertEquals(t.getClass(), InternalThread.class, "thread is not InternalThread"); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/MemoryLimitedLinkedBlockingQueueTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/MemoryLimitedLinkedBlockingQueueTest.java index 7744c02ba4..1196e5993d 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/MemoryLimitedLinkedBlockingQueueTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/MemoryLimitedLinkedBlockingQueueTest.java @@ -25,9 +25,9 @@ import java.lang.instrument.Instrumentation; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -public class MemoryLimitedLinkedBlockingQueueTest { +class MemoryLimitedLinkedBlockingQueueTest { @Test - public void test() throws Exception { + void test() throws Exception { ByteBuddyAgent.install(); final Instrumentation instrumentation = ByteBuddyAgent.getInstrumentation(); MemoryLimitedLinkedBlockingQueue queue = new MemoryLimitedLinkedBlockingQueue<>(1, instrumentation); @@ -38,4 +38,4 @@ public class MemoryLimitedLinkedBlockingQueueTest { queue.setMemoryLimit(Integer.MAX_VALUE); assertThat(queue.offer(() -> System.out.println("add success")), is(true)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/MemorySafeLinkedBlockingQueueTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/MemorySafeLinkedBlockingQueueTest.java index cb8b31b021..c8203e090c 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/MemorySafeLinkedBlockingQueueTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/MemorySafeLinkedBlockingQueueTest.java @@ -17,9 +17,10 @@ package org.apache.dubbo.common.threadpool; -import net.bytebuddy.agent.ByteBuddyAgent; import org.apache.dubbo.common.concurrent.AbortPolicy; import org.apache.dubbo.common.concurrent.RejectException; + +import net.bytebuddy.agent.ByteBuddyAgent; import org.junit.jupiter.api.Test; import java.lang.instrument.Instrumentation; @@ -28,9 +29,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertThrows; -public class MemorySafeLinkedBlockingQueueTest { +class MemorySafeLinkedBlockingQueueTest { @Test - public void test() throws Exception { + void test() throws Exception { ByteBuddyAgent.install(); final Instrumentation instrumentation = ByteBuddyAgent.getInstrumentation(); final long objectSize = instrumentation.getObjectSize((Runnable) () -> { @@ -48,7 +49,7 @@ public class MemorySafeLinkedBlockingQueueTest { } @Test - public void testCustomReject() throws Exception { + void testCustomReject() throws Exception { MemorySafeLinkedBlockingQueue queue = new MemorySafeLinkedBlockingQueue<>(Integer.MAX_VALUE); queue.setRejector(new AbortPolicy<>()); assertThrows(RejectException.class, () -> queue.offer(() -> { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/ThreadlessExecutorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/ThreadlessExecutorTest.java index 730d7cc927..fd806b9416 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/ThreadlessExecutorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/ThreadlessExecutorTest.java @@ -17,16 +17,13 @@ package org.apache.dubbo.common.threadpool; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.common.threadpool.manager.ExecutorRepository; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutorService; -public class ThreadlessExecutorTest { +class ThreadlessExecutorTest { private static ThreadlessExecutor executor; static { @@ -35,7 +32,7 @@ public class ThreadlessExecutorTest { } @Test - public void test() throws InterruptedException { + void test() throws InterruptedException { for (int i = 0; i < 10; i++) { executor.execute(()->{throw new RuntimeException("test");}); } diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/event/ThreadPoolExhaustedEventListenerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/event/ThreadPoolExhaustedEventListenerTest.java index dc2b32dde7..d064730f6b 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/event/ThreadPoolExhaustedEventListenerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/event/ThreadPoolExhaustedEventListenerTest.java @@ -24,7 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * {@link ThreadPoolExhaustedEvent} Test */ -public class ThreadPoolExhaustedEventListenerTest { +class ThreadPoolExhaustedEventListenerTest { private MyListener listener; @@ -35,7 +35,7 @@ public class ThreadPoolExhaustedEventListenerTest { } @Test - public void testOnEvent() { + void testOnEvent() { String msg = "Thread pool is EXHAUSTED! Thread Name: DubboServerHandler-127.0.0.1:12345, Pool Size: 1 (active: 0, core: 1, max: 1, largest: 1), Task: 6 (completed: 6), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://127.0.0.1:12345!, dubbo version: 2.7.3, current host: 127.0.0.1"; ThreadPoolExhaustedEvent exhaustedEvent = new ThreadPoolExhaustedEvent(msg); listener.onEvent(exhaustedEvent); @@ -55,4 +55,4 @@ public class ThreadPoolExhaustedEventListenerTest { return threadPoolExhaustedEvent; } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/event/ThreadPoolExhaustedEventTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/event/ThreadPoolExhaustedEventTest.java index 492c4b890e..8570b24af8 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/event/ThreadPoolExhaustedEventTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/event/ThreadPoolExhaustedEventTest.java @@ -23,13 +23,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * {@link ThreadPoolExhaustedEvent} Test */ -public class ThreadPoolExhaustedEventTest { +class ThreadPoolExhaustedEventTest { @Test - public void test() { + void test() { String msg = "Thread pool is EXHAUSTED! Thread Name: DubboServerHandler-127.0.0.1:12345, Pool Size: 1 (active: 0, core: 1, max: 1, largest: 1), Task: 6 (completed: 6), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://127.0.0.1:12345!, dubbo version: 2.7.3, current host: 127.0.0.1"; ThreadPoolExhaustedEvent event = new ThreadPoolExhaustedEvent(msg); assertEquals(msg, event.getMsg()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/manager/ExecutorRepositoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/manager/ExecutorRepositoryTest.java index 91a92f6cb8..3edc2672a5 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/manager/ExecutorRepositoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/manager/ExecutorRepositoryTest.java @@ -29,7 +29,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.atomic.AtomicBoolean; -public class ExecutorRepositoryTest { +class ExecutorRepositoryTest { private ApplicationModel applicationModel; private ExecutorRepository executorRepository; @@ -45,7 +45,7 @@ public class ExecutorRepositoryTest { } @Test - public void testGetExecutor() { + void testGetExecutor() { testGet(URL.valueOf("dubbo://127.0.0.1:23456/TestService")); testGet(URL.valueOf("dubbo://127.0.0.1:23456/TestService?side=consumer")); @@ -67,7 +67,7 @@ public class ExecutorRepositoryTest { } @Test - public void testUpdateExecutor() { + void testUpdateExecutor() { URL url = URL.valueOf("dubbo://127.0.0.1:23456/TestService?threads=5"); ThreadPoolExecutor executorService = (ThreadPoolExecutor) executorRepository.createExecutorIfAbsent(url); @@ -91,7 +91,7 @@ public class ExecutorRepositoryTest { } @Test - public void testSharedExecutor() throws Exception { + void testSharedExecutor() throws Exception { ExecutorService sharedExecutor = executorRepository.getSharedExecutor(); MockTask task1 = new MockTask(2000); MockTask task2 = new MockTask(100); @@ -141,4 +141,4 @@ public class ExecutorRepositoryTest { return running.get(); } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/manager/FrameworkExecutorRepositoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/manager/FrameworkExecutorRepositoryTest.java index a62abaa2b7..f240d146be 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/manager/FrameworkExecutorRepositoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/manager/FrameworkExecutorRepositoryTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicBoolean; -public class FrameworkExecutorRepositoryTest { +class FrameworkExecutorRepositoryTest { private FrameworkModel frameworkModel; private FrameworkExecutorRepository frameworkExecutorRepository; @@ -42,14 +42,14 @@ public class FrameworkExecutorRepositoryTest { } @Test - public void testGetExecutor() { + void testGetExecutor() { Assertions.assertNotNull(frameworkExecutorRepository.getSharedExecutor()); frameworkExecutorRepository.nextScheduledExecutor(); } @Test - public void testSharedExecutor() throws Exception { + void testSharedExecutor() throws Exception { ExecutorService sharedExecutor = frameworkExecutorRepository.getSharedExecutor(); FrameworkExecutorRepositoryTest.MockTask task1 = new FrameworkExecutorRepositoryTest.MockTask(2000); FrameworkExecutorRepositoryTest.MockTask task2 = new FrameworkExecutorRepositoryTest.MockTask(100); @@ -99,4 +99,4 @@ public class FrameworkExecutorRepositoryTest { return running.get(); } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/serial/SerializingExecutorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/serial/SerializingExecutorTest.java index 6d123789a7..7095378fdd 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/serial/SerializingExecutorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/serial/SerializingExecutorTest.java @@ -29,7 +29,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; -public class SerializingExecutorTest { +class SerializingExecutorTest { protected static SerializingExecutor serializingExecutor; @@ -40,7 +40,7 @@ public class SerializingExecutorTest { } @Test - public void test1() throws InterruptedException { + void test1() throws InterruptedException { int n = 2; int eachCount = 1000; int total = n * eachCount; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReportTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReportTest.java index 909c8417a6..ebeef9f22f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReportTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReportTest.java @@ -31,9 +31,9 @@ import static org.apache.dubbo.common.constants.CommonConstants.OS_NAME_KEY; import static org.apache.dubbo.common.constants.CommonConstants.OS_WIN_PREFIX; import static org.junit.jupiter.api.Assertions.assertEquals; -public class AbortPolicyWithReportTest { +class AbortPolicyWithReportTest { @Test - public void jStackDumpTest() throws InterruptedException { + void jStackDumpTest() throws InterruptedException { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?dump.directory=/tmp&version=1.0.0&application=morgan&noValue="); AbortPolicyWithReport abortPolicyWithReport = new AbortPolicyWithReport("Test", url); @@ -48,7 +48,7 @@ public class AbortPolicyWithReportTest { } @Test - public void jStackDumpTest_dumpDirectoryNotExists_cannotBeCreatedTakeUserHome() throws InterruptedException { + void jStackDumpTest_dumpDirectoryNotExists_cannotBeCreatedTakeUserHome() throws InterruptedException { final String dumpDirectory = dumpDirectoryCannotBeCreated(); URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?dump.directory=" @@ -81,7 +81,7 @@ public class AbortPolicyWithReportTest { } @Test - public void jStackDumpTest_dumpDirectoryNotExists_canBeCreated() throws InterruptedException { + void jStackDumpTest_dumpDirectoryNotExists_canBeCreated() throws InterruptedException { final String dumpDirectory = UUID.randomUUID().toString(); URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?dump.directory=" @@ -104,7 +104,7 @@ public class AbortPolicyWithReportTest { } @Test - public void test_dispatchThreadPoolExhaustedEvent() { + void test_dispatchThreadPoolExhaustedEvent() { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?dump.directory=/tmp&version=1.0.0&application=morgan&noValue="); AbortPolicyWithReport abortPolicyWithReport = new AbortPolicyWithReport("Test", url); String msg = "Thread pool is EXHAUSTED! Thread Name: DubboServerHandler-127.0.0.1:12345, Pool Size: 1 (active: 0, core: 1, max: 1, largest: 1), Task: 6 (completed: 6), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://127.0.0.1:12345!, dubbo version: 2.7.3, current host: 127.0.0.1"; @@ -128,4 +128,4 @@ public class AbortPolicyWithReportTest { return threadPoolExhaustedEvent; } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/cached/CachedThreadPoolTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/cached/CachedThreadPoolTest.java index f345970fb0..91267b1768 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/cached/CachedThreadPoolTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/cached/CachedThreadPoolTest.java @@ -42,9 +42,9 @@ import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.startsWith; -public class CachedThreadPoolTest { +class CachedThreadPoolTest { @Test - public void getExecutor1() throws Exception { + void getExecutor1() throws Exception { URL url = URL.valueOf("dubbo://10.20.130.230:20880/context/path?" + THREAD_NAME_KEY + "=demo&" + CORE_THREADS_KEY + "=1&" + @@ -72,10 +72,10 @@ public class CachedThreadPoolTest { } @Test - public void getExecutor2() throws Exception { + void getExecutor2() throws Exception { URL url = URL.valueOf("dubbo://10.20.130.230:20880/context/path?" + QUEUES_KEY + "=1"); ThreadPool threadPool = new CachedThreadPool(); ThreadPoolExecutor executor = (ThreadPoolExecutor) threadPool.getExecutor(url); assertThat(executor.getQueue(), Matchers.>instanceOf(LinkedBlockingQueue.class)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolExecutorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolExecutorTest.java index 89e8e4a2ec..a172982a2e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolExecutorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolExecutorTest.java @@ -30,7 +30,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.TimeUnit; -public class EagerThreadPoolExecutorTest { +class EagerThreadPoolExecutorTest { private static final URL URL = new ServiceConfigURL("dubbo", "localhost", 8080); @@ -56,7 +56,7 @@ public class EagerThreadPoolExecutorTest { * the thread pool create thread (but thread nums always less than max) instead of put task into queue. */ @Test - public void testEagerThreadPool() throws Exception { + void testEagerThreadPool() throws Exception { String name = "eager-tf"; int queues = 5; int cores = 5; @@ -93,7 +93,7 @@ public class EagerThreadPoolExecutorTest { } @Test - public void testSPI() { + void testSPI() { ExecutorService executorService = (ExecutorService) ExtensionLoader.getExtensionLoader(ThreadPool.class) .getExtension("eager") .getExecutor(URL); @@ -102,7 +102,7 @@ public class EagerThreadPoolExecutorTest { } @Test - public void testEagerThreadPool_rejectExecution() throws Exception { + void testEagerThreadPool_rejectExecution() throws Exception { String name = "eager-tf"; int cores = 1; int threads = 3; @@ -135,4 +135,4 @@ public class EagerThreadPoolExecutorTest { Thread.sleep(10000); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolTest.java index cb8e9e2661..7c5f9e450f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/EagerThreadPoolTest.java @@ -41,9 +41,9 @@ import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.startsWith; -public class EagerThreadPoolTest { +class EagerThreadPoolTest { @Test - public void getExecutor1() throws Exception { + void getExecutor1() throws Exception { URL url = URL.valueOf("dubbo://10.20.130.230:20880/context/path?" + THREAD_NAME_KEY + "=demo&" + CORE_THREADS_KEY + "=1&" + @@ -74,11 +74,11 @@ public class EagerThreadPoolTest { } @Test - public void getExecutor2() throws Exception { + void getExecutor2() throws Exception { URL url = URL.valueOf("dubbo://10.20.130.230:20880/context/path?" + QUEUES_KEY + "=2"); ThreadPool threadPool = new EagerThreadPool(); ThreadPoolExecutor executor = (ThreadPoolExecutor) threadPool.getExecutor(url); assertThat(executor.getQueue().remainingCapacity(), is(2)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/TaskQueueTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/TaskQueueTest.java index 534fe6a016..42c4bf6c23 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/TaskQueueTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/eager/TaskQueueTest.java @@ -28,10 +28,10 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.mockito.Mockito.mock; -public class TaskQueueTest { +class TaskQueueTest { @Test - public void testOffer1() throws Exception { + void testOffer1() throws Exception { Assertions.assertThrows(RejectedExecutionException.class, () -> { TaskQueue queue = new TaskQueue(1); queue.offer(mock(Runnable.class)); @@ -39,7 +39,7 @@ public class TaskQueueTest { } @Test - public void testOffer2() throws Exception { + void testOffer2() throws Exception { TaskQueue queue = new TaskQueue(1); EagerThreadPoolExecutor executor = mock(EagerThreadPoolExecutor.class); Mockito.when(executor.getPoolSize()).thenReturn(2); @@ -49,7 +49,7 @@ public class TaskQueueTest { } @Test - public void testOffer3() throws Exception { + void testOffer3() throws Exception { TaskQueue queue = new TaskQueue(1); EagerThreadPoolExecutor executor = mock(EagerThreadPoolExecutor.class); Mockito.when(executor.getPoolSize()).thenReturn(2); @@ -60,7 +60,7 @@ public class TaskQueueTest { } @Test - public void testOffer4() throws Exception { + void testOffer4() throws Exception { TaskQueue queue = new TaskQueue(1); EagerThreadPoolExecutor executor = mock(EagerThreadPoolExecutor.class); Mockito.when(executor.getPoolSize()).thenReturn(4); @@ -71,7 +71,7 @@ public class TaskQueueTest { } @Test - public void testRetryOffer1() throws Exception { + void testRetryOffer1() throws Exception { Assertions.assertThrows(RejectedExecutionException.class, () -> { TaskQueue queue = new TaskQueue(1); EagerThreadPoolExecutor executor = mock(EagerThreadPoolExecutor.class); @@ -83,7 +83,7 @@ public class TaskQueueTest { @Test - public void testRetryOffer2() throws Exception { + void testRetryOffer2() throws Exception { TaskQueue queue = new TaskQueue(1); EagerThreadPoolExecutor executor = mock(EagerThreadPoolExecutor.class); Mockito.when(executor.isShutdown()).thenReturn(false); @@ -91,4 +91,4 @@ public class TaskQueueTest { assertThat(queue.retryOffer(mock(Runnable.class), 1000, TimeUnit.MILLISECONDS), is(true)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/fixed/FixedThreadPoolTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/fixed/FixedThreadPoolTest.java index ff8ac9225f..5a10dd934c 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/fixed/FixedThreadPoolTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/fixed/FixedThreadPoolTest.java @@ -42,9 +42,9 @@ import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.startsWith; -public class FixedThreadPoolTest { +class FixedThreadPoolTest { @Test - public void getExecutor1() throws Exception { + void getExecutor1() throws Exception { URL url = URL.valueOf("dubbo://10.20.130.230:20880/context/path?" + THREAD_NAME_KEY + "=demo&" + CORE_THREADS_KEY + "=1&" + @@ -75,10 +75,10 @@ public class FixedThreadPoolTest { } @Test - public void getExecutor2() throws Exception { + void getExecutor2() throws Exception { URL url = URL.valueOf("dubbo://10.20.130.230:20880/context/path?" + QUEUES_KEY + "=1"); ThreadPool threadPool = new FixedThreadPool(); ThreadPoolExecutor executor = (ThreadPoolExecutor) threadPool.getExecutor(url); assertThat(executor.getQueue(), Matchers.>instanceOf(LinkedBlockingQueue.class)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/limited/LimitedThreadPoolTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/limited/LimitedThreadPoolTest.java index 4878d3546c..0f44e65082 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/limited/LimitedThreadPoolTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/support/limited/LimitedThreadPoolTest.java @@ -41,9 +41,9 @@ import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.startsWith; -public class LimitedThreadPoolTest { +class LimitedThreadPoolTest { @Test - public void getExecutor1() throws Exception { + void getExecutor1() throws Exception { URL url = URL.valueOf("dubbo://10.20.130.230:20880/context/path?" + THREAD_NAME_KEY + "=demo&" + CORE_THREADS_KEY + "=1&" + @@ -73,10 +73,10 @@ public class LimitedThreadPoolTest { } @Test - public void getExecutor2() throws Exception { + void getExecutor2() throws Exception { URL url = URL.valueOf("dubbo://10.20.130.230:20880/context/path?" + QUEUES_KEY + "=1"); ThreadPool threadPool = new LimitedThreadPool(); ThreadPoolExecutor executor = (ThreadPoolExecutor) threadPool.getExecutor(url); assertThat(executor.getQueue(), Matchers.>instanceOf(LinkedBlockingQueue.class)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/timer/HashedWheelTimerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/timer/HashedWheelTimerTest.java index 6729b944a8..34d5d625f0 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/timer/HashedWheelTimerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/timer/HashedWheelTimerTest.java @@ -28,7 +28,7 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -public class HashedWheelTimerTest { +class HashedWheelTimerTest { private CountDownLatch tryStopTaskCountDownLatch = new CountDownLatch(1); private CountDownLatch errorTaskCountDownLatch = new CountDownLatch(1); @@ -68,7 +68,7 @@ public class HashedWheelTimerTest { } @Test - public void constructorTest() { + void constructorTest() { // use weak reference to let gc work every time // which can check finalize method and reduce memory usage in time WeakReference timer = new WeakReference<>(new HashedWheelTimer()); @@ -133,7 +133,7 @@ public class HashedWheelTimerTest { } @Test - public void createTaskTest() throws InterruptedException { + void createTaskTest() throws InterruptedException { HashedWheelTimer timer = new HashedWheelTimer( new NamedThreadFactory("dubbo-future-timeout", true), 10, @@ -178,7 +178,7 @@ public class HashedWheelTimerTest { } @Test - public void stopTaskTest() throws InterruptedException { + void stopTaskTest() throws InterruptedException { Timer timer = new HashedWheelTimer(new NamedThreadFactory("dubbo-future-timeout", true)); timer.newTimeout(new TryStopTask(timer), 10, TimeUnit.MILLISECONDS); tryStopTaskCountDownLatch.await(); @@ -195,4 +195,4 @@ public class HashedWheelTimerTest { () -> timer.newTimeout(new EmptyTask(), 5, TimeUnit.SECONDS)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/url/URLParamTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/url/URLParamTest.java index c7ea41c836..d230dd7bcf 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/url/URLParamTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/url/URLParamTest.java @@ -28,9 +28,9 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -public class URLParamTest { +class URLParamTest { @Test - public void testParseWithRawParam() { + void testParseWithRawParam() { URLParam urlParam1 = URLParam.parse("aaa=aaa&bbb&version=1.0&default.ccc=123"); Assertions.assertEquals("aaa", urlParam1.getParameter("aaa")); Assertions.assertEquals("bbb", urlParam1.getParameter("bbb")); @@ -55,7 +55,7 @@ public class URLParamTest { } @Test - public void testParseWithMap() { + void testParseWithMap() { Map map = new HashMap<>(); map.put("aaa", "aaa"); map.put("bbb", "bbb"); @@ -82,7 +82,7 @@ public class URLParamTest { } @Test - public void testGetParameter() { + void testGetParameter() { URLParam urlParam1 = URLParam.parse("aaa=aaa&bbb&version=1.0&default.ccc=123"); Assertions.assertNull(urlParam1.getParameter("abcde")); @@ -98,7 +98,7 @@ public class URLParamTest { } @Test - public void testHasParameter() { + void testHasParameter() { URLParam urlParam1 = URLParam.parse("aaa=aaa&side=provider"); Assertions.assertTrue(urlParam1.hasParameter("aaa")); Assertions.assertFalse(urlParam1.hasParameter("bbb")); @@ -107,7 +107,7 @@ public class URLParamTest { } @Test - public void testRemoveParameters() { + void testRemoveParameters() { URLParam urlParam1 = URLParam.parse("aaa=aaa&side=provider&version=1.0"); Assertions.assertTrue(urlParam1.hasParameter("aaa")); Assertions.assertTrue(urlParam1.hasParameter("side")); @@ -138,7 +138,7 @@ public class URLParamTest { } @Test - public void testAddParameters() { + void testAddParameters() { URLParam urlParam1 = URLParam.parse("aaa=aaa&side=provider"); Assertions.assertTrue(urlParam1.hasParameter("aaa")); Assertions.assertTrue(urlParam1.hasParameter("side")); @@ -186,7 +186,7 @@ public class URLParamTest { } @Test - public void testURLParamMap() { + void testURLParamMap() { URLParam urlParam1 = URLParam.parse(""); Assertions.assertTrue(urlParam1.getParameters().isEmpty()); Assertions.assertEquals(0, urlParam1.getParameters().size()); @@ -260,7 +260,7 @@ public class URLParamTest { } @Test - public void testMethodParameters() { + void testMethodParameters() { URLParam urlParam1 = URLParam.parse("aaa.method1=aaa&bbb.method2=bbb"); Assertions.assertEquals("aaa",urlParam1.getAnyMethodParameter("method1")); Assertions.assertEquals("bbb",urlParam1.getAnyMethodParameter("method2")); @@ -270,4 +270,4 @@ public class URLParamTest { Assertions.assertEquals("aaa",urlParam2.getAnyMethodParameter("method1")); Assertions.assertNull(urlParam2.getAnyMethodParameter("method2")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AnnotationUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AnnotationUtilsTest.java index 7dbdf3e085..84c1f6906d 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AnnotationUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AnnotationUtilsTest.java @@ -66,10 +66,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class AnnotationUtilsTest { +class AnnotationUtilsTest { @Test - public void testIsType() throws NoSuchMethodException { + void testIsType() throws NoSuchMethodException { // null checking assertFalse(isType(null)); // Method checking @@ -79,7 +79,7 @@ public class AnnotationUtilsTest { } @Test - public void testIsSameType() { + void testIsSameType() { assertTrue(isSameType(A.class.getAnnotation(Service.class), Service.class)); assertFalse(isSameType(A.class.getAnnotation(Service.class), Deprecated.class)); assertFalse(isSameType(A.class.getAnnotation(Service.class), null)); @@ -88,13 +88,13 @@ public class AnnotationUtilsTest { } @Test - public void testExcludedType() { + void testExcludedType() { assertFalse(excludedType(Service.class).test(A.class.getAnnotation(Service.class))); assertTrue(excludedType(Service.class).test(A.class.getAnnotation(Deprecated.class))); } @Test - public void testGetAttribute() { + void testGetAttribute() { Annotation annotation = A.class.getAnnotation(Service.class); assertEquals("java.lang.CharSequence", getAttribute(annotation, "interfaceName")); assertEquals(CharSequence.class, getAttribute(annotation, "interfaceClass")); @@ -106,7 +106,7 @@ public class AnnotationUtilsTest { } @Test - public void testGetAttributesMap() { + void testGetAttributesMap() { Annotation annotation = A.class.getAnnotation(Service.class); Map attributes = getAttributes(annotation, false); assertEquals("java.lang.CharSequence", attributes.get("interfaceName")); @@ -126,14 +126,14 @@ public class AnnotationUtilsTest { } @Test - public void testGetValue() { + void testGetValue() { Adaptive adaptive = A.class.getAnnotation(Adaptive.class); String[] value = getValue(adaptive); assertEquals(asList("a", "b", "c"), asList(value)); } @Test - public void testGetDeclaredAnnotations() { + void testGetDeclaredAnnotations() { List annotations = getDeclaredAnnotations(A.class); assertADeclaredAnnotations(annotations, 0); @@ -145,7 +145,7 @@ public class AnnotationUtilsTest { } @Test - public void testGetAllDeclaredAnnotations() { + void testGetAllDeclaredAnnotations() { List annotations = getAllDeclaredAnnotations(A.class); assertADeclaredAnnotations(annotations, 0); @@ -168,7 +168,7 @@ public class AnnotationUtilsTest { } @Test - public void testGetMetaAnnotations() { + void testGetMetaAnnotations() { List metaAnnotations = getMetaAnnotations(Service.class, a -> isSameType(a, Inherited.class)); assertEquals(1, metaAnnotations.size()); assertEquals(Inherited.class, metaAnnotations.get(0).annotationType()); @@ -184,7 +184,7 @@ public class AnnotationUtilsTest { } @Test - public void testGetAllMetaAnnotations() { + void testGetAllMetaAnnotations() { List metaAnnotations = getAllMetaAnnotations(Service5.class); int offset = 0; @@ -212,7 +212,7 @@ public class AnnotationUtilsTest { @Test - public void testIsAnnotationPresent() { + void testIsAnnotationPresent() { assertTrue(isAnnotationPresent(A.class, true, Service.class)); assertTrue(isAnnotationPresent(A.class, true, Service.class, com.alibaba.dubbo.config.annotation.Service.class)); assertTrue(isAnnotationPresent(A.class, Service.class)); @@ -222,7 +222,7 @@ public class AnnotationUtilsTest { } @Test - public void testIsAnyAnnotationPresent() { + void testIsAnyAnnotationPresent() { assertTrue(isAnyAnnotationPresent(A.class, Service.class, com.alibaba.dubbo.config.annotation.Service.class, Deprecated.class)); assertTrue(isAnyAnnotationPresent(A.class, Service.class, com.alibaba.dubbo.config.annotation.Service.class)); assertTrue(isAnyAnnotationPresent(A.class, Service.class, Deprecated.class)); @@ -233,7 +233,7 @@ public class AnnotationUtilsTest { } @Test - public void testGetAnnotation() { + void testGetAnnotation() { assertNotNull(getAnnotation(A.class, "org.apache.dubbo.config.annotation.Service")); assertNotNull(getAnnotation(A.class, "com.alibaba.dubbo.config.annotation.Service")); assertNotNull(getAnnotation(A.class, "org.apache.dubbo.common.extension.Adaptive")); @@ -243,7 +243,7 @@ public class AnnotationUtilsTest { } @Test - public void testFindAnnotation() { + void testFindAnnotation() { Service service = findAnnotation(A.class, Service.class); assertEquals("java.lang.CharSequence", service.interfaceName()); assertEquals(CharSequence.class, service.interfaceClass()); @@ -253,7 +253,7 @@ public class AnnotationUtilsTest { } @Test - public void testFindMetaAnnotations() { + void testFindMetaAnnotations() { List services = findMetaAnnotations(B.class, DubboService.class); assertEquals(1, services.size()); @@ -270,7 +270,7 @@ public class AnnotationUtilsTest { } @Test - public void testFindMetaAnnotation() { + void testFindMetaAnnotation() { DubboService service = findMetaAnnotation(B.class, DubboService.class); assertEquals(Cloneable.class, service.interfaceClass()); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ArrayUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ArrayUtilsTest.java index 4f7edf245e..fd0ae90b66 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ArrayUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ArrayUtilsTest.java @@ -22,20 +22,20 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ArrayUtilsTest { +class ArrayUtilsTest { @Test - public void isEmpty() throws Exception { + void isEmpty() throws Exception { assertTrue(ArrayUtils.isEmpty(null)); assertTrue(ArrayUtils.isEmpty(new Object[0])); assertFalse(ArrayUtils.isEmpty(new Object[]{"abc"})); } @Test - public void isNotEmpty() throws Exception { + void isNotEmpty() throws Exception { assertFalse(ArrayUtils.isNotEmpty(null)); assertFalse(ArrayUtils.isNotEmpty(new Object[0])); assertTrue(ArrayUtils.isNotEmpty(new Object[]{"abc"})); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AssertTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AssertTest.java index bea9488522..c8c9385b05 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AssertTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AssertTest.java @@ -23,39 +23,39 @@ import org.junit.jupiter.api.Test; import static org.apache.dubbo.common.utils.Assert.notEmptyString; import static org.apache.dubbo.common.utils.Assert.notNull; -public class AssertTest { +class AssertTest { @Test - public void testNotNull1() { + void testNotNull1() { Assertions.assertThrows(IllegalArgumentException.class, () -> notNull(null, "null object")); } @Test - public void testNotNull2() { + void testNotNull2() { Assertions.assertThrows(IllegalStateException.class, () -> notNull(null, new IllegalStateException("null object"))); } @Test - public void testNotNullWhenInputNotNull1() { + void testNotNullWhenInputNotNull1() { notNull(new Object(), "null object"); } @Test - public void testNotNullWhenInputNotNull2() { + void testNotNullWhenInputNotNull2() { notNull(new Object(), new IllegalStateException("null object")); } @Test - public void testNotNullString() { + void testNotNullString() { Assertions.assertThrows(IllegalArgumentException.class, () -> notEmptyString(null, "Message can't be null")); } @Test - public void testNotEmptyString() { + void testNotEmptyString() { Assertions.assertThrows(IllegalArgumentException.class, () -> notEmptyString("", "Message can't be null or empty")); } @Test - public void testNotNullNotEmptyString() { + void testNotNullNotEmptyString() { notEmptyString("abcd", "Message can'be null or empty"); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AtomicPositiveIntegerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AtomicPositiveIntegerTest.java index 90d0430fcf..1c2880ff03 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AtomicPositiveIntegerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/AtomicPositiveIntegerTest.java @@ -27,7 +27,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; -public class AtomicPositiveIntegerTest { +class AtomicPositiveIntegerTest { private AtomicPositiveInteger i1 = new AtomicPositiveInteger(); private AtomicPositiveInteger i2 = new AtomicPositiveInteger(127); @@ -35,14 +35,14 @@ public class AtomicPositiveIntegerTest { private AtomicPositiveInteger i3 = new AtomicPositiveInteger(Integer.MAX_VALUE); @Test - public void testGet() throws Exception { + void testGet() throws Exception { assertEquals(0, i1.get()); assertEquals(127, i2.get()); assertEquals(Integer.MAX_VALUE, i3.get()); } @Test - public void testSet() throws Exception { + void testSet() throws Exception { i1.set(100); assertEquals(100, i1.get()); @@ -56,7 +56,7 @@ public class AtomicPositiveIntegerTest { } @Test - public void testGetAndIncrement() throws Exception { + void testGetAndIncrement() throws Exception { int get = i1.getAndIncrement(); assertEquals(0, get); assertEquals(1, i1.get()); @@ -71,7 +71,7 @@ public class AtomicPositiveIntegerTest { } @Test - public void testGetAndDecrement() throws Exception { + void testGetAndDecrement() throws Exception { int get = i1.getAndDecrement(); assertEquals(0, get); assertEquals(Integer.MAX_VALUE, i1.get()); @@ -86,7 +86,7 @@ public class AtomicPositiveIntegerTest { } @Test - public void testIncrementAndGet() throws Exception { + void testIncrementAndGet() throws Exception { int get = i1.incrementAndGet(); assertEquals(1, get); assertEquals(1, i1.get()); @@ -101,7 +101,7 @@ public class AtomicPositiveIntegerTest { } @Test - public void testDecrementAndGet() throws Exception { + void testDecrementAndGet() throws Exception { int get = i1.decrementAndGet(); assertEquals(Integer.MAX_VALUE, get); assertEquals(Integer.MAX_VALUE, i1.get()); @@ -116,7 +116,7 @@ public class AtomicPositiveIntegerTest { } @Test - public void testGetAndSet() throws Exception { + void testGetAndSet() throws Exception { int get = i1.getAndSet(100); assertEquals(0, get); assertEquals(100, i1.get()); @@ -130,7 +130,7 @@ public class AtomicPositiveIntegerTest { } @Test - public void testGetAndAnd() throws Exception { + void testGetAndAnd() throws Exception { int get = i1.getAndAdd(3); assertEquals(0, get); assertEquals(3, i1.get()); @@ -146,7 +146,7 @@ public class AtomicPositiveIntegerTest { @Test - public void testAddAndGet() throws Exception { + void testAddAndGet() throws Exception { int get = i1.addAndGet(3); assertEquals(3, get); assertEquals(3, i1.get()); @@ -161,33 +161,33 @@ public class AtomicPositiveIntegerTest { } @Test - public void testCompareAndSet1() { + void testCompareAndSet1() { Assertions.assertThrows(IllegalArgumentException.class, () -> { i1.compareAndSet(i1.get(), -1); }); } @Test - public void testCompareAndSet2() { + void testCompareAndSet2() { assertThat(i1.compareAndSet(i1.get(), 2), is(true)); assertThat(i1.get(), is(2)); } @Test - public void testWeakCompareAndSet1() { + void testWeakCompareAndSet1() { Assertions.assertThrows(IllegalArgumentException.class, () -> { i1.weakCompareAndSet(i1.get(), -1); }); } @Test - public void testWeakCompareAndSet2() { + void testWeakCompareAndSet2() { assertThat(i1.weakCompareAndSet(i1.get(), 2), is(true)); assertThat(i1.get(), is(2)); } @Test - public void testValues() throws Exception { + void testValues() throws Exception { Integer i = i1.get(); assertThat(i1.byteValue(), equalTo(i.byteValue())); assertThat(i1.shortValue(), equalTo(i.shortValue())); @@ -199,8 +199,8 @@ public class AtomicPositiveIntegerTest { } @Test - public void testEquals() { + void testEquals() { assertEquals(new AtomicPositiveInteger(), new AtomicPositiveInteger()); assertEquals(new AtomicPositiveInteger(1), new AtomicPositiveInteger(1)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CIDRUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CIDRUtilsTest.java index 89e023f72b..2264cb795a 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CIDRUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CIDRUtilsTest.java @@ -21,10 +21,10 @@ import org.junit.jupiter.api.Test; import java.net.UnknownHostException; -public class CIDRUtilsTest { +class CIDRUtilsTest { @Test - public void testIpv4() throws UnknownHostException { + void testIpv4() throws UnknownHostException { CIDRUtils cidrUtils = new CIDRUtils("192.168.1.0/26"); Assertions.assertTrue(cidrUtils.isInRange("192.168.1.63")); Assertions.assertFalse(cidrUtils.isInRange("192.168.1.65")); @@ -35,7 +35,7 @@ public class CIDRUtilsTest { } @Test - public void testIpv6() throws UnknownHostException { + void testIpv6() throws UnknownHostException { CIDRUtils cidrUtils = new CIDRUtils("234e:0:4567::3d/64"); Assertions.assertTrue(cidrUtils.isInRange("234e:0:4567::3e")); Assertions.assertTrue(cidrUtils.isInRange("234e:0:4567::ffff:3e")); @@ -50,4 +50,4 @@ public class CIDRUtilsTest { Assertions.assertFalse(cidrUtils.isInRange("3EFE:FFFE:0:C107::dd")); Assertions.assertFalse(cidrUtils.isInRange("1FFE:FFFE:0:CC00::dd")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ClassLoaderResourceLoaderTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ClassLoaderResourceLoaderTest.java index efcfdbf783..09dcfd8e67 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ClassLoaderResourceLoaderTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ClassLoaderResourceLoaderTest.java @@ -31,10 +31,10 @@ import java.util.Set; /** * {@link ClassLoaderResourceLoader} */ -public class ClassLoaderResourceLoaderTest { +class ClassLoaderResourceLoaderTest { @Test - public void test() throws InterruptedException { + void test() throws InterruptedException { DubboInternalLoadingStrategy dubboInternalLoadingStrategy = new DubboInternalLoadingStrategy(); String directory = dubboInternalLoadingStrategy.directory(); String type = FooAppProvider.class.getName(); @@ -56,4 +56,4 @@ public class ClassLoaderResourceLoaderTest { ClassLoaderResourceLoader.destroy(); Assertions.assertNull(ClassLoaderResourceLoader.getClassLoaderResourcesCache()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ClassUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ClassUtilsTest.java index a28e924d51..6fa46643cc 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ClassUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ClassUtilsTest.java @@ -27,9 +27,9 @@ import static org.hamcrest.Matchers.sameInstance; import static org.hamcrest.Matchers.startsWith; import static org.mockito.Mockito.verify; -public class ClassUtilsTest { +class ClassUtilsTest { @Test - public void testForNameWithThreadContextClassLoader() throws Exception { + void testForNameWithThreadContextClassLoader() throws Exception { ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); try { ClassLoader classLoader = Mockito.mock(ClassLoader.class); @@ -42,18 +42,18 @@ public class ClassUtilsTest { } @Test - public void tetForNameWithCallerClassLoader() throws Exception { + void tetForNameWithCallerClassLoader() throws Exception { Class c = ClassUtils.forNameWithCallerClassLoader(ClassUtils.class.getName(), ClassUtilsTest.class); assertThat(c == ClassUtils.class, is(true)); } @Test - public void testGetCallerClassLoader() throws Exception { + void testGetCallerClassLoader() throws Exception { assertThat(ClassUtils.getCallerClassLoader(ClassUtilsTest.class), sameInstance(ClassUtilsTest.class.getClassLoader())); } @Test - public void testGetClassLoader1() throws Exception { + void testGetClassLoader1() throws Exception { ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); try { assertThat(ClassUtils.getClassLoader(ClassUtilsTest.class), sameInstance(oldClassLoader)); @@ -65,31 +65,31 @@ public class ClassUtilsTest { } @Test - public void testGetClassLoader2() throws Exception { + void testGetClassLoader2() throws Exception { assertThat(ClassUtils.getClassLoader(), sameInstance(ClassUtils.class.getClassLoader())); } @Test - public void testForName1() throws Exception { + void testForName1() throws Exception { assertThat(ClassUtils.forName(ClassUtilsTest.class.getName()) == ClassUtilsTest.class, is(true)); } @Test - public void testForName2() throws Exception { + void testForName2() throws Exception { assertThat(ClassUtils.forName("byte") == byte.class, is(true)); assertThat(ClassUtils.forName("java.lang.String[]") == String[].class, is(true)); assertThat(ClassUtils.forName("[Ljava.lang.String;") == String[].class, is(true)); } @Test - public void testForName3() throws Exception { + void testForName3() throws Exception { ClassLoader classLoader = Mockito.mock(ClassLoader.class); ClassUtils.forName("a.b.c.D", classLoader); verify(classLoader).loadClass("a.b.c.D"); } @Test - public void testResolvePrimitiveClassName() throws Exception { + void testResolvePrimitiveClassName() throws Exception { assertThat(ClassUtils.resolvePrimitiveClassName("boolean") == boolean.class, is(true)); assertThat(ClassUtils.resolvePrimitiveClassName("byte") == byte.class, is(true)); assertThat(ClassUtils.resolvePrimitiveClassName("char") == char.class, is(true)); @@ -109,13 +109,13 @@ public class ClassUtilsTest { } @Test - public void testToShortString() throws Exception { + void testToShortString() throws Exception { assertThat(ClassUtils.toShortString(null), equalTo("null")); assertThat(ClassUtils.toShortString(new ClassUtilsTest()), startsWith("ClassUtilsTest@")); } @Test - public void testConvertPrimitive() throws Exception { + void testConvertPrimitive() throws Exception { assertThat(ClassUtils.convertPrimitive(char.class, ""), equalTo(null)); assertThat(ClassUtils.convertPrimitive(char.class, null), equalTo(null)); @@ -151,4 +151,4 @@ public class ClassUtilsTest { assertThat(ClassUtils.convertPrimitive(double.class, "10.1"), equalTo(Double.valueOf(10.1))); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CollectionUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CollectionUtilsTest.java index d40ab82ab4..3516e75178 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CollectionUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CollectionUtilsTest.java @@ -17,6 +17,7 @@ package org.apache.dubbo.common.utils; import org.apache.dubbo.config.ProtocolConfig; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -47,9 +48,9 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CollectionUtilsTest { +class CollectionUtilsTest { @Test - public void testSort() throws Exception { + void testSort() throws Exception { List list = new ArrayList(); list.add(100); list.add(10); @@ -64,14 +65,14 @@ public class CollectionUtilsTest { } @Test - public void testSortNull() throws Exception { + void testSortNull() throws Exception { assertNull(CollectionUtils.sort(null)); assertTrue(CollectionUtils.sort(new ArrayList()).isEmpty()); } @Test - public void testSortSimpleName() throws Exception { + void testSortSimpleName() throws Exception { List list = new ArrayList(); list.add("aaa.z"); list.add("b"); @@ -86,14 +87,14 @@ public class CollectionUtilsTest { } @Test - public void testSortSimpleNameNull() throws Exception { + void testSortSimpleNameNull() throws Exception { assertNull(CollectionUtils.sortSimpleName(null)); assertTrue(CollectionUtils.sortSimpleName(new ArrayList()).isEmpty()); } @Test - public void testFlip() { + void testFlip() { assertEquals(CollectionUtils.flip(null), null); Map input1 = new HashMap<>(); input1.put("k1", null); @@ -109,7 +110,7 @@ public class CollectionUtilsTest { } @Test - public void testSplitAll() throws Exception { + void testSplitAll() throws Exception { assertNull(CollectionUtils.splitAll(null, null)); assertNull(CollectionUtils.splitAll(null, "-")); @@ -131,7 +132,7 @@ public class CollectionUtilsTest { } @Test - public void testJoinAll() throws Exception { + void testJoinAll() throws Exception { assertNull(CollectionUtils.joinAll(null, null)); assertNull(CollectionUtils.joinAll(null, "-")); @@ -158,7 +159,7 @@ public class CollectionUtilsTest { } @Test - public void testJoinList() throws Exception { + void testJoinList() throws Exception { List list = emptyList(); assertEquals("", CollectionUtils.join(list, "/")); @@ -170,7 +171,7 @@ public class CollectionUtilsTest { } @Test - public void testMapEquals() throws Exception { + void testMapEquals() throws Exception { assertTrue(CollectionUtils.mapEquals(null, null)); assertFalse(CollectionUtils.mapEquals(null, new HashMap())); assertFalse(CollectionUtils.mapEquals(new HashMap(), null)); @@ -180,17 +181,17 @@ public class CollectionUtilsTest { } @Test - public void testStringMap1() throws Exception { + void testStringMap1() throws Exception { assertThat(toStringMap("key", "value"), equalTo(Collections.singletonMap("key", "value"))); } @Test - public void testStringMap2() throws Exception { + void testStringMap2() throws Exception { Assertions.assertThrows(IllegalArgumentException.class, () -> toStringMap("key", "value", "odd")); } @Test - public void testToMap1() throws Exception { + void testToMap1() throws Exception { assertTrue(CollectionUtils.toMap().isEmpty()); Map expected = new HashMap(); @@ -202,7 +203,7 @@ public class CollectionUtilsTest { } @Test - public void testObjectToMap() throws Exception { + void testObjectToMap() throws Exception { ProtocolConfig protocolConfig=new ProtocolConfig(); protocolConfig.setSerialization("fastjson2"); @@ -210,24 +211,24 @@ public class CollectionUtilsTest { } @Test - public void testToMap2() throws Exception { + void testToMap2() throws Exception { Assertions.assertThrows(IllegalArgumentException.class, () -> toMap("a", "b", "c")); } @Test - public void testIsEmpty() throws Exception { + void testIsEmpty() throws Exception { assertThat(isEmpty(null), is(true)); assertThat(isEmpty(new HashSet()), is(true)); assertThat(isEmpty(emptyList()), is(true)); } @Test - public void testIsNotEmpty() throws Exception { + void testIsNotEmpty() throws Exception { assertThat(isNotEmpty(singleton("a")), is(true)); } @Test - public void testOfSet() { + void testOfSet() { Set set = ofSet(); assertEquals(emptySet(), set); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CompatibleTypeUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CompatibleTypeUtilsTest.java index ee9adc2c0e..1599d25a4f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CompatibleTypeUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/CompatibleTypeUtilsTest.java @@ -34,11 +34,11 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CompatibleTypeUtilsTest { +class CompatibleTypeUtilsTest { @SuppressWarnings("unchecked") @Test - public void testCompatibleTypeConvert() throws Exception { + void testCompatibleTypeConvert() throws Exception { Object result; { @@ -219,4 +219,4 @@ public class CompatibleTypeUtilsTest { } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ConfigUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ConfigUtilsTest.java index 787b8372ec..b63aa5322e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ConfigUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ConfigUtilsTest.java @@ -42,7 +42,7 @@ import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertEquals; -public class ConfigUtilsTest { +class ConfigUtilsTest { private Properties properties; @BeforeEach @@ -55,12 +55,12 @@ public class ConfigUtilsTest { } @Test - public void testIsNotEmpty() throws Exception { + void testIsNotEmpty() throws Exception { assertThat(ConfigUtils.isNotEmpty("abc"), is(true)); } @Test - public void testIsEmpty() throws Exception { + void testIsEmpty() throws Exception { assertThat(ConfigUtils.isEmpty(null), is(true)); assertThat(ConfigUtils.isEmpty(""), is(true)); assertThat(ConfigUtils.isEmpty("false"), is(true)); @@ -73,7 +73,7 @@ public class ConfigUtilsTest { } @Test - public void testIsDefault() throws Exception { + void testIsDefault() throws Exception { assertThat(ConfigUtils.isDefault("true"), is(true)); assertThat(ConfigUtils.isDefault("TRUE"), is(true)); assertThat(ConfigUtils.isDefault("default"), is(true)); @@ -81,27 +81,27 @@ public class ConfigUtilsTest { } @Test - public void testMergeValues() { + void testMergeValues() { List merged = ConfigUtils.mergeValues(ApplicationModel.defaultModel().getExtensionDirector(), ThreadPool.class, "aaa,bbb,default.custom", asList("fixed", "default.limited", "cached")); assertEquals(asList("fixed", "cached", "aaa", "bbb", "default.custom"), merged); } @Test - public void testMergeValuesAddDefault() { + void testMergeValuesAddDefault() { List merged = ConfigUtils.mergeValues(ApplicationModel.defaultModel().getExtensionDirector(), ThreadPool.class, "aaa,bbb,default,zzz", asList("fixed", "default.limited", "cached")); assertEquals(asList("aaa", "bbb", "fixed", "cached", "zzz"), merged); } @Test - public void testMergeValuesDeleteDefault() { + void testMergeValuesDeleteDefault() { List merged = ConfigUtils.mergeValues(ApplicationModel.defaultModel().getExtensionDirector(), ThreadPool.class, "-default", asList("fixed", "default.limited", "cached")); assertEquals(Collections.emptyList(), merged); } @Test - public void testMergeValuesDeleteDefault_2() { + void testMergeValuesDeleteDefault_2() { List merged = ConfigUtils.mergeValues(ApplicationModel.defaultModel().getExtensionDirector(), ThreadPool.class, "-default,aaa", asList("fixed", "default.limited", "cached")); assertEquals(asList("aaa"), merged); } @@ -110,13 +110,13 @@ public class ConfigUtilsTest { * The user configures -default, which will delete all the default parameters */ @Test - public void testMergeValuesDelete() { + void testMergeValuesDelete() { List merged = ConfigUtils.mergeValues(ApplicationModel.defaultModel().getExtensionDirector(), ThreadPool.class, "-fixed,aaa", asList("fixed", "default.limited", "cached")); assertEquals(asList("cached", "aaa"), merged); } @Test - public void testReplaceProperty() throws Exception { + void testReplaceProperty() throws Exception { String s = ConfigUtils.replaceProperty("1${a.b.c}2${a.b.c}3", Collections.singletonMap("a.b.c", "ABC")); assertEquals( "1ABC2ABC3", s); s = ConfigUtils.replaceProperty("1${a.b.c}2${a.b.c}3", Collections.emptyMap()); @@ -124,7 +124,7 @@ public class ConfigUtilsTest { } @Test - public void testReplaceProperty2() { + void testReplaceProperty2() { InmemoryConfiguration configuration1 = new InmemoryConfiguration(); configuration1.getProperties().put("zookeeper.address", "127.0.0.1"); @@ -146,7 +146,7 @@ public class ConfigUtilsTest { } @Test - public void testGetProperties1() throws Exception { + void testGetProperties1() throws Exception { try { System.setProperty(CommonConstants.DUBBO_PROPERTIES_KEY, "properties.load"); Properties p = ConfigUtils.getProperties(Collections.emptySet()); @@ -159,14 +159,14 @@ public class ConfigUtilsTest { } @Test - public void testGetProperties2() throws Exception { + void testGetProperties2() throws Exception { System.clearProperty(CommonConstants.DUBBO_PROPERTIES_KEY); Properties p = ConfigUtils.getProperties(Collections.emptySet()); assertThat((String) p.get("dubbo"), equalTo("properties")); } @Test - public void testLoadPropertiesNoFile() throws Exception { + void testLoadPropertiesNoFile() throws Exception { Properties p = ConfigUtils.loadProperties(Collections.emptySet(), "notExisted", true); Properties expected = new Properties(); assertEquals(expected, p); @@ -176,17 +176,17 @@ public class ConfigUtilsTest { } @Test - public void testGetProperty() throws Exception { + void testGetProperty() throws Exception { assertThat(properties.getProperty("dubbo"), equalTo("properties")); } @Test - public void testGetPropertyDefaultValue() throws Exception { + void testGetPropertyDefaultValue() throws Exception { assertThat(properties.getProperty("not-exist", "default"), equalTo("default")); } @Test - public void testGetSystemProperty() throws Exception { + void testGetSystemProperty() throws Exception { try { System.setProperty("dubbo", "system-only"); assertThat(ConfigUtils.getSystemProperty("dubbo"), equalTo("system-only")); @@ -196,13 +196,13 @@ public class ConfigUtilsTest { } @Test - public void testLoadProperties() throws Exception { + void testLoadProperties() throws Exception { Properties p = ConfigUtils.loadProperties(Collections.emptySet(), "dubbo.properties"); assertThat((String)p.get("dubbo"), equalTo("properties")); } @Test - public void testLoadPropertiesOneFile() throws Exception { + void testLoadPropertiesOneFile() throws Exception { Properties p = ConfigUtils.loadProperties(Collections.emptySet(), "properties.load", false); Properties expected = new Properties(); @@ -214,7 +214,7 @@ public class ConfigUtilsTest { } @Test - public void testLoadPropertiesOneFileAllowMulti() throws Exception { + void testLoadPropertiesOneFileAllowMulti() throws Exception { Properties p = ConfigUtils.loadProperties(Collections.emptySet(), "properties.load", true); Properties expected = new Properties(); @@ -226,7 +226,7 @@ public class ConfigUtilsTest { } @Test - public void testLoadPropertiesOneFileNotRootPath() throws Exception { + void testLoadPropertiesOneFileNotRootPath() throws Exception { Properties p = ConfigUtils.loadProperties(Collections.emptySet(), "META-INF/dubbo/internal/org.apache.dubbo.common.threadpool.ThreadPool", false); Properties expected = new Properties(); @@ -241,7 +241,7 @@ public class ConfigUtilsTest { @Disabled("Not know why disabled, the original link explaining this was reachable.") @Test - public void testLoadPropertiesMultiFileNotRootPathException() throws Exception { + void testLoadPropertiesMultiFileNotRootPathException() throws Exception { try { ConfigUtils.loadProperties(Collections.emptySet(), "META-INF/services/org.apache.dubbo.common.status.StatusChecker", false); Assertions.fail(); @@ -251,7 +251,7 @@ public class ConfigUtilsTest { } @Test - public void testLoadPropertiesMultiFileNotRootPath() throws Exception { + void testLoadPropertiesMultiFileNotRootPath() throws Exception { Properties p = ConfigUtils.loadProperties(Collections.emptySet(), "META-INF/dubbo/internal/org.apache.dubbo.common.status.StatusChecker", true); @@ -264,12 +264,12 @@ public class ConfigUtilsTest { } @Test - public void testGetPid() throws Exception { + void testGetPid() throws Exception { assertThat(ConfigUtils.getPid(), greaterThan(0)); } @Test - public void testPropertiesWithStructedValue() throws Exception { + void testPropertiesWithStructedValue() throws Exception { Properties p = ConfigUtils.loadProperties(Collections.emptySet(), "parameters.properties", false); Properties expected = new Properties(); @@ -279,10 +279,10 @@ public class ConfigUtilsTest { } @Test - public void testLoadMigrationRule() { + void testLoadMigrationRule() { Set classLoaderSet = new HashSet<>(); classLoaderSet.add(ClassUtils.getClassLoader()); String rule = ConfigUtils.loadMigrationRule(classLoaderSet, "dubbo-migration.yaml"); Assertions.assertNotNull(rule); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/DefaultPageTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/DefaultPageTest.java index 41c0e03ff3..72b30db554 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/DefaultPageTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/DefaultPageTest.java @@ -28,10 +28,10 @@ import static java.util.Arrays.asList; * * @since 2.7.5 */ -public class DefaultPageTest { +class DefaultPageTest { @Test - public void test() { + void test() { List data = asList(1, 2, 3, 4, 5); DefaultPage page = new DefaultPage<>(0, 1, data.subList(0, 1), data.size()); Assertions.assertEquals(page.getOffset(), 0); @@ -41,4 +41,4 @@ public class DefaultPageTest { Assertions.assertEquals(page.getTotalPages(), 5); Assertions.assertTrue(page.hasNext()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/DubboAppenderTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/DubboAppenderTest.java index 24cb10539a..4528f9ad7e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/DubboAppenderTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/DubboAppenderTest.java @@ -23,16 +23,17 @@ import org.apache.log4j.spi.LoggingEvent; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; + import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.equalTo; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assumptions.assumeFalse; import static org.junit.jupiter.api.Assumptions.assumeTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; -public class DubboAppenderTest { +class DubboAppenderTest { private LoggingEvent event; @BeforeEach @@ -51,7 +52,7 @@ public class DubboAppenderTest { } @Test - public void testAvailable() { + void testAvailable() { assumeFalse(DubboAppender.available); DubboAppender.doStart(); assertThat(DubboAppender.available, is(true)); @@ -60,7 +61,7 @@ public class DubboAppenderTest { } @Test - public void testAppend() { + void testAppend() { DubboAppender appender = new DubboAppender(); appender.append(event); assumeTrue(0 == DubboAppender.logList.size()); @@ -71,7 +72,7 @@ public class DubboAppenderTest { } @Test - public void testClear() { + void testClear() { DubboAppender.doStart(); DubboAppender appender = new DubboAppender(); appender.append(event); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ExecutorUtilTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ExecutorUtilTest.java index 3d0f46540d..c6d3846b17 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ExecutorUtilTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ExecutorUtilTest.java @@ -35,9 +35,9 @@ import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class ExecutorUtilTest { +class ExecutorUtilTest { @Test - public void testIsTerminated() throws Exception { + void testIsTerminated() throws Exception { ExecutorService executor = Mockito.mock(ExecutorService.class); when(executor.isTerminated()).thenReturn(true); assertThat(ExecutorUtil.isTerminated(executor), is(true)); @@ -46,7 +46,7 @@ public class ExecutorUtilTest { } @Test - public void testGracefulShutdown1() throws Exception { + void testGracefulShutdown1() throws Exception { ExecutorService executor = Mockito.mock(ExecutorService.class); when(executor.isTerminated()).thenReturn(false, true); when(executor.awaitTermination(20, TimeUnit.MILLISECONDS)).thenReturn(false); @@ -56,7 +56,7 @@ public class ExecutorUtilTest { } @Test - public void testGracefulShutdown2() throws Exception { + void testGracefulShutdown2() throws Exception { ExecutorService executor = Mockito.mock(ExecutorService.class); when(executor.isTerminated()).thenReturn(false, false, false); when(executor.awaitTermination(20, TimeUnit.MILLISECONDS)).thenReturn(false); @@ -68,7 +68,7 @@ public class ExecutorUtilTest { } @Test - public void testShutdownNow() throws Exception { + void testShutdownNow() throws Exception { ExecutorService executor = Mockito.mock(ExecutorService.class); when(executor.isTerminated()).thenReturn(false, true); ExecutorUtil.shutdownNow(executor, 20); @@ -77,9 +77,9 @@ public class ExecutorUtilTest { } @Test - public void testSetThreadName() throws Exception { + void testSetThreadName() throws Exception { URL url = new ServiceConfigURL("dubbo", "localhost", 1234).addParameter(THREAD_NAME_KEY, "custom-thread"); url = ExecutorUtil.setThreadName(url, "default-name"); assertThat(url.getParameter(THREAD_NAME_KEY), equalTo("custom-thread-localhost:1234")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/FieldUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/FieldUtilsTest.java index e85995a3ac..8266e70521 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/FieldUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/FieldUtilsTest.java @@ -30,10 +30,10 @@ import static org.junit.jupiter.api.Assertions.assertNull; * * @since 2.7.6 */ -public class FieldUtilsTest { +class FieldUtilsTest { @Test - public void testGetDeclaredField() { + void testGetDeclaredField() { assertEquals("a", getDeclaredField(A.class, "a").getName()); assertEquals("b", getDeclaredField(B.class, "b").getName()); assertEquals("c", getDeclaredField(C.class, "c").getName()); @@ -42,7 +42,7 @@ public class FieldUtilsTest { } @Test - public void testFindField() { + void testFindField() { assertEquals("a", findField(A.class, "a").getName()); assertEquals("a", findField(new A(), "a").getName()); assertEquals("a", findField(B.class, "a").getName()); @@ -53,7 +53,7 @@ public class FieldUtilsTest { } @Test - public void testGetFieldValue() { + void testGetFieldValue() { assertEquals("a", getFieldValue(new A(), "a")); assertEquals("a", getFieldValue(new B(), "a")); assertEquals("b", getFieldValue(new B(), "b")); @@ -63,7 +63,7 @@ public class FieldUtilsTest { } @Test - public void setSetFieldValue() { + void setSetFieldValue() { A a = new A(); assertEquals("a", setFieldValue(a, "a", "x")); assertEquals("x", getFieldValue(a, "a")); @@ -85,4 +85,4 @@ class B extends A { class C extends B { private String c = "c"; -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/HolderTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/HolderTest.java index 0735ad3c83..d6fc36bcb6 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/HolderTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/HolderTest.java @@ -22,12 +22,12 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -public class HolderTest { +class HolderTest { @Test - public void testSetAndGet() throws Exception { + void testSetAndGet() throws Exception { Holder holder = new Holder(); String message = "hello"; holder.set(message); assertThat(holder.get(), is(message)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/IOUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/IOUtilsTest.java index 687348cad2..c23d3b2427 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/IOUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/IOUtilsTest.java @@ -38,7 +38,7 @@ import java.nio.file.Path; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class IOUtilsTest { +class IOUtilsTest { private static String TEXT = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; private InputStream is; @@ -63,32 +63,32 @@ public class IOUtilsTest { } @Test - public void testWrite1() throws Exception { + void testWrite1() throws Exception { assertThat((int) IOUtils.write(is, os, 16), equalTo(TEXT.length())); } @Test - public void testWrite2() throws Exception { + void testWrite2() throws Exception { assertThat((int) IOUtils.write(reader, writer, 16), equalTo(TEXT.length())); } @Test - public void testWrite3() throws Exception { + void testWrite3() throws Exception { assertThat((int) IOUtils.write(writer, TEXT), equalTo(TEXT.length())); } @Test - public void testWrite4() throws Exception { + void testWrite4() throws Exception { assertThat((int) IOUtils.write(is, os), equalTo(TEXT.length())); } @Test - public void testWrite5() throws Exception { + void testWrite5() throws Exception { assertThat((int) IOUtils.write(reader, writer), equalTo(TEXT.length())); } @Test - public void testLines(@TempDir Path tmpDir) throws Exception { + void testLines(@TempDir Path tmpDir) throws Exception { File file = tmpDir.getFileName().toAbsolutePath().toFile(); IOUtils.writeLines(file, new String[]{TEXT}); String[] lines = IOUtils.readLines(file); @@ -98,26 +98,26 @@ public class IOUtilsTest { } @Test - public void testReadLines() throws Exception { + void testReadLines() throws Exception { String[] lines = IOUtils.readLines(is); assertThat(lines.length, equalTo(1)); assertThat(lines[0], equalTo(TEXT)); } @Test - public void testWriteLines() throws Exception { + void testWriteLines() throws Exception { IOUtils.writeLines(os, new String[]{TEXT}); ByteArrayOutputStream bos = (ByteArrayOutputStream) os; assertThat(new String(bos.toByteArray()), equalTo(TEXT + System.lineSeparator())); } @Test - public void testRead() throws Exception { + void testRead() throws Exception { assertThat(IOUtils.read(reader), equalTo(TEXT)); } @Test - public void testAppendLines(@TempDir Path tmpDir) throws Exception { + void testAppendLines(@TempDir Path tmpDir) throws Exception { File file = tmpDir.getFileName().toAbsolutePath().toFile(); IOUtils.appendLines(file, new String[]{"a", "b", "c"}); String[] lines = IOUtils.readLines(file); @@ -127,4 +127,4 @@ public class IOUtilsTest { assertThat(lines[2], equalTo("c")); tmpDir.getFileName().toAbsolutePath().toFile().delete(); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/JVMUtilTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/JVMUtilTest.java index d980c26335..5276dabf70 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/JVMUtilTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/JVMUtilTest.java @@ -17,5 +17,5 @@ package org.apache.dubbo.common.utils; -public class JVMUtilTest { -} +class JVMUtilTest { +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/JsonUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/JsonUtilsTest.java index 15f75a954e..d0993c3add 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/JsonUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/JsonUtilsTest.java @@ -34,9 +34,9 @@ import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; -public class JsonUtilsTest { +class JsonUtilsTest { @Test - public void testGetJson1() { + void testGetJson1() { Assertions.assertNotNull(JsonUtils.getJson()); Assertions.assertEquals(JsonUtils.getJson(), JsonUtils.getJson()); @@ -162,7 +162,7 @@ public class JsonUtilsTest { } @Test - public void testGetJson2() { + void testGetJson2() { ClassLoader originClassLoader = Thread.currentThread().getContextClassLoader(); AtomicReference> removedPackages = new AtomicReference<>(Collections.emptyList()); ClassLoader newClassLoader = new ClassLoader(originClassLoader) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LFUCacheTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LFUCacheTest.java index d7a725089e..abee14aecb 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LFUCacheTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LFUCacheTest.java @@ -24,10 +24,10 @@ import java.io.IOException; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class LFUCacheTest { +class LFUCacheTest { @Test - public void testCacheEviction() throws Exception { + void testCacheEviction() throws Exception { LFUCache cache = new LFUCache<>(8, 0.8f); cache.put("one", 1); cache.put("two", 2); @@ -48,7 +48,7 @@ public class LFUCacheTest { } @Test - public void testCacheRemove() throws Exception { + void testCacheRemove() throws Exception { LFUCache cache = new LFUCache<>(8, 0.8f); cache.put("one", 1); cache.put("two", 2); @@ -68,16 +68,16 @@ public class LFUCacheTest { } @Test - public void testDefaultCapacity() throws Exception { + void testDefaultCapacity() throws Exception { LFUCache cache = new LFUCache<>(); assertThat(cache.getCapacity(), equalTo(1000)); } @Test - public void testErrorConstructArguments() throws IOException { + void testErrorConstructArguments() throws IOException { Assertions.assertThrows(IllegalArgumentException.class, () -> new LFUCache<>(0, 0.8f)); Assertions.assertThrows(IllegalArgumentException.class, () -> new LFUCache<>(-1, 0.8f)); Assertions.assertThrows(IllegalArgumentException.class, () -> new LFUCache<>(100, 0.0f)); Assertions.assertThrows(IllegalArgumentException.class, () -> new LFUCache<>(100, -0.1f)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LRU2CacheTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LRU2CacheTest.java index a616a33633..8dab9afeac 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LRU2CacheTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LRU2CacheTest.java @@ -24,9 +24,9 @@ import static org.hamcrest.Matchers.equalTo; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class LRU2CacheTest { +class LRU2CacheTest { @Test - public void testCache() throws Exception { + void testCache() throws Exception { LRU2Cache cache = new LRU2Cache(3); cache.put("one", 1); cache.put("two", 2); @@ -62,10 +62,10 @@ public class LRU2CacheTest { } @Test - public void testCapacity() throws Exception { + void testCapacity() throws Exception { LRU2Cache cache = new LRU2Cache(); assertThat(cache.getMaxCapacity(), equalTo(1000)); cache.setMaxCapacity(10); assertThat(cache.getMaxCapacity(), equalTo(10)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogHelperTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogHelperTest.java index 5134b95a83..fd8a041b8f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogHelperTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogHelperTest.java @@ -25,10 +25,10 @@ import org.mockito.Mockito; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class LogHelperTest { +class LogHelperTest { @Test - public void testTrace() throws Exception { + void testTrace() throws Exception { Logger logger = Mockito.mock(Logger.class); when(logger.isTraceEnabled()).thenReturn(true); LogHelper.trace(logger, "trace"); @@ -41,7 +41,7 @@ public class LogHelperTest { } @Test - public void testDebug() throws Exception { + void testDebug() throws Exception { Logger logger = Mockito.mock(Logger.class); when(logger.isDebugEnabled()).thenReturn(true); LogHelper.debug(logger, "debug"); @@ -54,7 +54,7 @@ public class LogHelperTest { } @Test - public void testInfo() throws Exception { + void testInfo() throws Exception { Logger logger = Mockito.mock(Logger.class); when(logger.isInfoEnabled()).thenReturn(true); LogHelper.info(logger, "info"); @@ -67,7 +67,7 @@ public class LogHelperTest { } @Test - public void testWarn() throws Exception { + void testWarn() throws Exception { Logger logger = Mockito.mock(Logger.class); when(logger.isWarnEnabled()).thenReturn(true); LogHelper.warn(logger, "warn"); @@ -80,7 +80,7 @@ public class LogHelperTest { } @Test - public void testError() throws Exception { + void testError() throws Exception { Logger logger = Mockito.mock(Logger.class); when(logger.isErrorEnabled()).thenReturn(true); LogHelper.error(logger, "error"); @@ -91,4 +91,4 @@ public class LogHelperTest { LogHelper.error(logger, "error", t); verify(logger).error("error", t); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogTest.java index 39b60ab849..a357ae6fa8 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogTest.java @@ -25,9 +25,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; -public class LogTest { +class LogTest { @Test - public void testLogName() throws Exception { + void testLogName() throws Exception { Log log1 = new Log(); Log log2 = new Log(); Log log3 = new Log(); @@ -41,7 +41,7 @@ public class LogTest { } @Test - public void testLogLevel() throws Exception { + void testLogLevel() throws Exception { Log log1 = new Log(); Log log2 = new Log(); Log log3 = new Log(); @@ -55,7 +55,7 @@ public class LogTest { } @Test - public void testLogMessage() throws Exception { + void testLogMessage() throws Exception { Log log1 = new Log(); Log log2 = new Log(); Log log3 = new Log(); @@ -69,7 +69,7 @@ public class LogTest { } @Test - public void testLogThread() throws Exception { + void testLogThread() throws Exception { Log log1 = new Log(); Log log2 = new Log(); Log log3 = new Log(); @@ -82,4 +82,4 @@ public class LogTest { Assertions.assertNotEquals(log1, log3); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogUtilTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogUtilTest.java index 4793d7bc92..9af6e22fff 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogUtilTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/LogUtilTest.java @@ -27,14 +27,14 @@ import static org.hamcrest.Matchers.is; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class LogUtilTest { +class LogUtilTest { @AfterEach public void tearDown() throws Exception { DubboAppender.logList.clear(); } @Test - public void testStartStop() throws Exception { + void testStartStop() throws Exception { LogUtil.start(); assertThat(DubboAppender.available, is(true)); LogUtil.stop(); @@ -42,7 +42,7 @@ public class LogUtilTest { } @Test - public void testCheckNoError() throws Exception { + void testCheckNoError() throws Exception { Log log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogLevel()).thenReturn(Level.ERROR); @@ -52,7 +52,7 @@ public class LogUtilTest { } @Test - public void testFindName() throws Exception { + void testFindName() throws Exception { Log log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogName()).thenReturn("a"); @@ -60,7 +60,7 @@ public class LogUtilTest { } @Test - public void testFindLevel() throws Exception { + void testFindLevel() throws Exception { Log log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogLevel()).thenReturn(Level.ERROR); @@ -69,7 +69,7 @@ public class LogUtilTest { } @Test - public void testFindLevelWithThreadName() throws Exception { + void testFindLevelWithThreadName() throws Exception { Log log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogLevel()).thenReturn(Level.ERROR); @@ -82,7 +82,7 @@ public class LogUtilTest { } @Test - public void testFindThread() throws Exception { + void testFindThread() throws Exception { Log log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogThread()).thenReturn("thread-1"); @@ -90,7 +90,7 @@ public class LogUtilTest { } @Test - public void testFindMessage1() throws Exception { + void testFindMessage1() throws Exception { Log log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogMessage()).thenReturn("message"); @@ -98,7 +98,7 @@ public class LogUtilTest { } @Test - public void testFindMessage2() throws Exception { + void testFindMessage2() throws Exception { Log log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogMessage()).thenReturn("message"); @@ -110,4 +110,4 @@ public class LogUtilTest { assertThat(LogUtil.findMessage(Level.ERROR, "message"), equalTo(1)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MD5UtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MD5UtilsTest.java index 4a5ca05709..d5a0a46d0d 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MD5UtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MD5UtilsTest.java @@ -27,10 +27,10 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -public class MD5UtilsTest { +class MD5UtilsTest { @Test - public void test() { + void test() { MD5Utils sharedMd5Utils = new MD5Utils(); final String[] input = {"provider-appgroup-one/org.apache.dubbo.config.spring.api.HelloService:dubboorg.apache.dubbo.config.spring.api.HelloService{REGISTRY_CLUSTER=registry-one, anyhost=true, application=provider-app, background=false, compiler=javassist, deprecated=false, dubbo=2.0.2, dynamic=true, file.cache=false, generic=false, group=group-one, interface=org.apache.dubbo.config.spring.api.HelloService, logger=slf4j, metadata-type=remote, methods=sayHello, organization=test, owner=com.test, release=, service-name-mapping=true, side=provider}", "provider-appgroup-two/org.apache.dubbo.config.spring.api.DemoService:dubboorg.apache.dubbo.config.spring.api.DemoService{REGISTRY_CLUSTER=registry-two, anyhost=true, application=provider-app, background=false, compiler=javassist, deprecated=false, dubbo=2.0.2, dynamic=true, file.cache=false, generic=false, group=group-two, interface=org.apache.dubbo.config.spring.api.DemoService, logger=slf4j, metadata-type=remote, methods=sayName,getBox, organization=test, owner=com.test, release=, service-name-mapping=true, side=provider}"}; @@ -92,4 +92,4 @@ public class MD5UtilsTest { } } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MemberUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MemberUtilsTest.java index a5a78cc765..c1f322fc80 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MemberUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MemberUtilsTest.java @@ -29,17 +29,21 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class MemberUtilsTest { +class MemberUtilsTest { @Test - public void testIsStatic() throws NoSuchMethodException { + void test() throws NoSuchMethodException { - assertFalse(isStatic(getClass().getMethod("testIsStatic"))); + assertFalse(isStatic(getClass().getMethod("noStatic"))); assertTrue(isStatic(getClass().getMethod("staticMethod"))); assertTrue(isPrivate(getClass().getDeclaredMethod("privateMethod"))); assertTrue(isPublic(getClass().getMethod("publicMethod"))); } + public void noStatic() throws NoSuchMethodException { + + } + public static void staticMethod() { } diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MethodUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MethodUtilsTest.java index c174b6899b..b986c3d662 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MethodUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/MethodUtilsTest.java @@ -32,10 +32,10 @@ import static org.apache.dubbo.common.utils.MethodUtils.getMethods; import static org.apache.dubbo.common.utils.MethodUtils.invokeMethod; import static org.apache.dubbo.common.utils.MethodUtils.overrides; -public class MethodUtilsTest { +class MethodUtilsTest { @Test - public void testGetMethod() { + void testGetMethod() { Method getMethod = null; for (Method method : MethodTestClazz.class.getMethods()) { if (MethodUtils.isGetter(method)) { @@ -47,7 +47,7 @@ public class MethodUtilsTest { } @Test - public void testSetMethod() { + void testSetMethod() { Method setMethod = null; for (Method method : MethodTestClazz.class.getMethods()) { if (MethodUtils.isSetter(method)) { @@ -59,13 +59,13 @@ public class MethodUtilsTest { } @Test - public void testIsDeprecated() throws Exception { + void testIsDeprecated() throws Exception { Assertions.assertTrue(MethodUtils.isDeprecated(MethodTestClazz.class.getMethod("deprecatedMethod"))); Assertions.assertFalse(MethodUtils.isDeprecated(MethodTestClazz.class.getMethod("getValue"))); } @Test - public void testIsMetaMethod() { + void testIsMetaMethod() { boolean containMetaMethod = false; for (Method method : MethodTestClazz.class.getMethods()) { if (MethodUtils.isMetaMethod(method)) { @@ -76,7 +76,7 @@ public class MethodUtilsTest { } @Test - public void testGetMethods() throws NoSuchMethodException { + void testGetMethods() throws NoSuchMethodException { Assertions.assertTrue(getDeclaredMethods(MethodTestClazz.class, excludedDeclaredClass(String.class)).size() > 0); Assertions.assertTrue(getMethods(MethodTestClazz.class).size() > 0); Assertions.assertTrue(getAllDeclaredMethods(MethodTestClazz.class).size() > 0); @@ -97,7 +97,7 @@ public class MethodUtilsTest { } @Test - public void testExtractFieldName() throws Exception { + void testExtractFieldName() throws Exception { Method m1 = MethodFieldTestClazz.class.getMethod("is"); Method m2 = MethodFieldTestClazz.class.getMethod("get"); Method m3 = MethodFieldTestClazz.class.getMethod("getClass"); @@ -170,4 +170,4 @@ public class MethodUtilsTest { } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NamedThreadFactoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NamedThreadFactoryTest.java index c28b701a77..a2dc5a84c9 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NamedThreadFactoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NamedThreadFactoryTest.java @@ -27,9 +27,9 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; -public class NamedThreadFactoryTest { +class NamedThreadFactoryTest { @Test - public void testNewThread() throws Exception { + void testNewThread() throws Exception { NamedThreadFactory factory = new NamedThreadFactory(); Thread t = factory.newThread(Mockito.mock(Runnable.class)); assertThat(t.getName(), allOf(containsString("pool-"), containsString("-thread-"))); @@ -39,10 +39,10 @@ public class NamedThreadFactoryTest { } @Test - public void testPrefixAndDaemon() throws Exception { + void testPrefixAndDaemon() throws Exception { NamedThreadFactory factory = new NamedThreadFactory("prefix", true); Thread t = factory.newThread(Mockito.mock(Runnable.class)); assertThat(t.getName(), allOf(containsString("prefix-"), containsString("-thread-"))); assertTrue(t.isDaemon()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NetUtilsInterfaceDisplayNameHasMetaCharactersTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NetUtilsInterfaceDisplayNameHasMetaCharactersTest.java index 19200270ec..4e835745ae 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NetUtilsInterfaceDisplayNameHasMetaCharactersTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NetUtilsInterfaceDisplayNameHasMetaCharactersTest.java @@ -28,13 +28,13 @@ import java.util.NoSuchElementException; import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_NETWORK_IGNORED_INTERFACE; import static org.junit.jupiter.api.Assertions.assertTrue; -public class NetUtilsInterfaceDisplayNameHasMetaCharactersTest { +class NetUtilsInterfaceDisplayNameHasMetaCharactersTest { private static final String IGNORED_DISPLAY_NAME_HAS_METACHARACTERS = "Mock(R) ^$*+[?].|-[0-9] Adapter"; private static final String SELECTED_DISPLAY_NAME = "Selected Adapter"; private static final String SELECTED_HOST_ADDR = "192.168.0.1"; @Test - public void testIgnoreGivenInterfaceNameWithMetaCharacters() throws Exception { + void testIgnoreGivenInterfaceNameWithMetaCharacters() throws Exception { String originIgnoredInterfaces = this.getIgnoredInterfaces(); // mock static methods of final class NetworkInterface try (MockedStatic mockedStaticNetif = Mockito.mockStatic(NetworkInterface.class)) { @@ -110,4 +110,4 @@ public class NetUtilsInterfaceDisplayNameHasMetaCharactersTest { } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NetUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NetUtilsTest.java index 79f01df758..accdb9afc8 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NetUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/NetUtilsTest.java @@ -398,4 +398,4 @@ class NetUtilsTest { System.setProperty(DUBBO_NETWORK_IGNORED_INTERFACE, ""); } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ParametersTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ParametersTest.java index 52a1f03c64..21cc63950b 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ParametersTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ParametersTest.java @@ -21,7 +21,7 @@ import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; -public class ParametersTest { +class ParametersTest { final String ServiceName = "org.apache.dubbo.rpc.service.GenericService"; final String ServiceVersion = "1.0.15"; final String LoadBalance = "lcr"; @@ -44,4 +44,4 @@ public class ParametersTest { assertEquals(map.get("version"), ServiceVersion); assertEquals(map.get("lb"), LoadBalance); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PojoUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PojoUtilsTest.java index 6a0f1ef69e..e4b8b15c9c 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PojoUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PojoUtilsTest.java @@ -114,7 +114,7 @@ public class PojoUtilsTest { } @Test - public void test_primitive() throws Exception { + void test_primitive() throws Exception { assertObject(Boolean.TRUE); assertObject(Boolean.FALSE); @@ -134,19 +134,19 @@ public class PojoUtilsTest { } @Test - public void test_pojo() throws Exception { + void test_pojo() throws Exception { assertObject(new Person()); assertObject(new BasicTestData(false, '\0', (byte) 0, (short) 0, 0, 0L, 0F, 0D)); assertObject(new SerializablePerson(Character.MIN_VALUE, false)); } @Test - public void test_has_no_nullary_constructor_pojo() { + void test_has_no_nullary_constructor_pojo() { assertObject(new User(1, "fibbery")); } @Test - public void test_Map_List_pojo() throws Exception { + void test_Map_List_pojo() throws Exception { Map> map = new HashMap>(); List list = new ArrayList(); @@ -161,7 +161,7 @@ public class PojoUtilsTest { } @Test - public void test_PrimitiveArray() throws Exception { + void test_PrimitiveArray() throws Exception { assertObject(new boolean[]{true, false}); assertObject(new Boolean[]{true, false, true}); @@ -210,7 +210,7 @@ public class PojoUtilsTest { } @Test - public void test_PojoArray() throws Exception { + void test_PojoArray() throws Exception { Person[] array = new Person[2]; array[0] = new Person(); { @@ -222,7 +222,7 @@ public class PojoUtilsTest { } @Test - public void testArrayToCollection() throws Exception { + void testArrayToCollection() throws Exception { Person[] array = new Person[2]; Person person1 = new Person(); person1.setName("person1"); @@ -237,7 +237,7 @@ public class PojoUtilsTest { } @Test - public void testCollectionToArray() throws Exception { + void testCollectionToArray() throws Exception { Person person1 = new Person(); person1.setName("person1"); Person person2 = new Person(); @@ -252,7 +252,7 @@ public class PojoUtilsTest { } @Test - public void testMapToEnum() throws Exception { + void testMapToEnum() throws Exception { Map map = new HashMap(); map.put("name", "MONDAY"); Object o = PojoUtils.realize(map, Day.class); @@ -260,7 +260,7 @@ public class PojoUtilsTest { } @Test - public void testGeneralizeEnumArray() throws Exception { + void testGeneralizeEnumArray() throws Exception { Object days = new Enum[]{Day.FRIDAY, Day.SATURDAY}; Object o = PojoUtils.generalize(days); assertTrue(o instanceof String[]); @@ -269,7 +269,7 @@ public class PojoUtilsTest { } @Test - public void testGeneralizePersons() throws Exception { + void testGeneralizePersons() throws Exception { Object persons = new Person[]{new Person(), new Person()}; Object o = PojoUtils.generalize(persons); assertTrue(o instanceof Object[]); @@ -277,7 +277,7 @@ public class PojoUtilsTest { } @Test - public void testMapToInterface() throws Exception { + void testMapToInterface() throws Exception { Map map = new HashMap(); map.put("content", "greeting"); map.put("from", "dubbo"); @@ -290,7 +290,7 @@ public class PojoUtilsTest { } @Test - public void testJsonObjectToMap() throws Exception { + void testJsonObjectToMap() throws Exception { Method method = PojoUtilsTest.class.getMethod("setMap", Map.class); assertNotNull(method); JSONObject jsonObject = new JSONObject(); @@ -304,7 +304,7 @@ public class PojoUtilsTest { } @Test - public void testListJsonObjectToListMap() throws Exception { + void testListJsonObjectToListMap() throws Exception { Method method = PojoUtilsTest.class.getMethod("setListMap", List.class); assertNotNull(method); JSONObject jsonObject = new JSONObject(); @@ -327,7 +327,7 @@ public class PojoUtilsTest { } @Test - public void testException() throws Exception { + void testException() throws Exception { Map map = new HashMap(); map.put("message", "dubbo exception"); Object o = PojoUtils.realize(map, RuntimeException.class); @@ -335,7 +335,7 @@ public class PojoUtilsTest { } @Test - public void testIsPojo() throws Exception { + void testIsPojo() throws Exception { assertFalse(PojoUtils.isPojo(boolean.class)); assertFalse(PojoUtils.isPojo(Map.class)); assertFalse(PojoUtils.isPojo(List.class)); @@ -362,7 +362,7 @@ public class PojoUtilsTest { } @Test - public void test_simpleCollection() throws Exception { + void test_simpleCollection() throws Exception { Type gtype = getType("returnListPersonMethod"); List list = new ArrayList(); list.add(new Person()); @@ -375,7 +375,7 @@ public class PojoUtilsTest { } @Test - public void test_total() throws Exception { + void test_total() throws Exception { Object generalize = PojoUtils.generalize(bigPerson); Type gtype = getType("returnBigPersonMethod"); Object realize = PojoUtils.realize(generalize, BigPerson.class, gtype); @@ -383,7 +383,7 @@ public class PojoUtilsTest { } @Test - public void test_total_Array() throws Exception { + void test_total_Array() throws Exception { Object[] persons = new Object[]{bigPerson, bigPerson, bigPerson}; Object generalize = PojoUtils.generalize(persons); @@ -392,7 +392,7 @@ public class PojoUtilsTest { } @Test - public void test_Loop_pojo() throws Exception { + void test_Loop_pojo() throws Exception { Parent p = new Parent(); p.setAge(10); p.setName("jerry"); @@ -414,7 +414,7 @@ public class PojoUtilsTest { } @Test - public void test_Loop_Map() throws Exception { + void test_Loop_Map() throws Exception { Map map = new HashMap(); map.put("k", "v"); @@ -432,7 +432,7 @@ public class PojoUtilsTest { } @Test - public void test_LoopPojoInMap() throws Exception { + void test_LoopPojoInMap() throws Exception { Parent p = new Parent(); p.setAge(10); p.setName("jerry"); @@ -460,7 +460,7 @@ public class PojoUtilsTest { } @Test - public void test_LoopPojoInList() throws Exception { + void test_LoopPojoInList() throws Exception { Parent p = new Parent(); p.setAge(10); p.setName("jerry"); @@ -491,7 +491,7 @@ public class PojoUtilsTest { } @Test - public void test_PojoInList() throws Exception { + void test_PojoInList() throws Exception { Parent p = new Parent(); p.setAge(10); p.setName("jerry"); @@ -525,7 +525,7 @@ public class PojoUtilsTest { // java.lang.IllegalArgumentException: argument type mismatch @Test - public void test_realize_LongPararmter_IllegalArgumentException() throws Exception { + void test_realize_LongPararmter_IllegalArgumentException() throws Exception { Method method = PojoUtilsTest.class.getMethod("setLong", long.class); assertNotNull(method); @@ -536,7 +536,7 @@ public class PojoUtilsTest { // java.lang.IllegalArgumentException: argument type mismatch @Test - public void test_realize_IntPararmter_IllegalArgumentException() throws Exception { + void test_realize_IntPararmter_IllegalArgumentException() throws Exception { Method method = PojoUtilsTest.class.getMethod("setInt", int.class); assertNotNull(method); @@ -546,7 +546,7 @@ public class PojoUtilsTest { } @Test - public void testStackOverflow() throws Exception { + void testStackOverflow() throws Exception { Parent parent = Parent.getNewParent(); parent.setAge(Integer.MAX_VALUE); String name = UUID.randomUUID().toString(); @@ -563,7 +563,7 @@ public class PojoUtilsTest { } @Test - public void testGenerializeAndRealizeClass() throws Exception { + void testGenerializeAndRealizeClass() throws Exception { Object generalize = PojoUtils.generalize(Integer.class); assertEquals(Integer.class.getName(), generalize); Object real = PojoUtils.realize(generalize, Integer.class.getClass()); @@ -576,7 +576,7 @@ public class PojoUtilsTest { } @Test - public void testPublicField() throws Exception { + void testPublicField() throws Exception { Parent parent = new Parent(); parent.gender = "female"; parent.email = "email@host.com"; @@ -596,7 +596,7 @@ public class PojoUtilsTest { } @Test - public void testMapField() throws Exception { + void testMapField() throws Exception { TestData data = new TestData(); Child child = newChild("first", 1); data.addChild(child); @@ -629,7 +629,7 @@ public class PojoUtilsTest { } @Test - public void testRealize() throws Exception { + void testRealize() throws Exception { Map map = new LinkedHashMap(); map.put("key", "value"); Object obj = PojoUtils.generalize(map); @@ -642,7 +642,7 @@ public class PojoUtilsTest { } @Test - public void testRealizeLinkedList() throws Exception { + void testRealizeLinkedList() throws Exception { LinkedList input = new LinkedList(); Person person = new Person(); person.setAge(37); @@ -655,7 +655,7 @@ public class PojoUtilsTest { } @Test - public void testPojoList() throws Exception { + void testPojoList() throws Exception { ListResult result = new ListResult(); List list = new ArrayList(); Parent parent = new Parent(); @@ -677,7 +677,7 @@ public class PojoUtilsTest { } @Test - public void testListPojoListPojo() throws Exception { + void testListPojoListPojo() throws Exception { InnerPojo parentList = new InnerPojo(); Parent parent = new Parent(); parent.setName("zhangsan"); @@ -704,7 +704,7 @@ public class PojoUtilsTest { } @Test - public void testDateTimeTimestamp() throws Exception { + void testDateTimeTimestamp() throws Exception { String dateStr = "2018-09-12"; String timeStr = "10:12:33"; String dateTimeStr = "2018-09-12 10:12:33"; @@ -732,7 +732,7 @@ public class PojoUtilsTest { } @Test - public void testIntToBoolean() throws Exception { + void testIntToBoolean() throws Exception { Map map = new HashMap<>(); map.put("name", "myname"); map.put("male", 1); @@ -746,7 +746,7 @@ public class PojoUtilsTest { } @Test - public void testRealizeCollectionWithNullElement() { + void testRealizeCollectionWithNullElement() { LinkedList listStr = new LinkedList<>(); listStr.add("arrayValue"); listStr.add(null); @@ -764,7 +764,7 @@ public class PojoUtilsTest { } @Test - public void testJava8Time() { + void testJava8Time() { Object localDateTimeGen = PojoUtils.generalize(LocalDateTime.now()); Object localDateTime = PojoUtils.realize(localDateTimeGen, LocalDateTime.class); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ReflectUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ReflectUtilsTest.java index e6a31e63cc..2b2022e852 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ReflectUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ReflectUtilsTest.java @@ -44,16 +44,16 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -public class ReflectUtilsTest { +class ReflectUtilsTest { @Test - public void testIsPrimitives() throws Exception { + void testIsPrimitives() throws Exception { assertTrue(ReflectUtils.isPrimitives(boolean[].class)); assertTrue(ReflectUtils.isPrimitives(byte.class)); assertFalse(ReflectUtils.isPrimitive(Map[].class)); } @Test - public void testIsPrimitive() throws Exception { + void testIsPrimitive() throws Exception { assertTrue(ReflectUtils.isPrimitive(boolean.class)); assertTrue(ReflectUtils.isPrimitive(String.class)); assertTrue(ReflectUtils.isPrimitive(Boolean.class)); @@ -64,7 +64,7 @@ public class ReflectUtilsTest { } @Test - public void testGetBoxedClass() throws Exception { + void testGetBoxedClass() throws Exception { assertThat(ReflectUtils.getBoxedClass(int.class), sameInstance(Integer.class)); assertThat(ReflectUtils.getBoxedClass(boolean.class), sameInstance(Boolean.class)); assertThat(ReflectUtils.getBoxedClass(long.class), sameInstance(Long.class)); @@ -77,7 +77,7 @@ public class ReflectUtilsTest { } @Test - public void testIsCompatible() throws Exception { + void testIsCompatible() throws Exception { assertTrue(ReflectUtils.isCompatible(short.class, (short) 1)); assertTrue(ReflectUtils.isCompatible(int.class, 1)); assertTrue(ReflectUtils.isCompatible(double.class, 1.2)); @@ -86,21 +86,21 @@ public class ReflectUtilsTest { } @Test - public void testIsCompatibleWithArray() throws Exception { + void testIsCompatibleWithArray() throws Exception { assertFalse(ReflectUtils.isCompatible(new Class[]{short.class, int.class}, new Object[]{(short) 1})); assertFalse(ReflectUtils.isCompatible(new Class[]{double.class}, new Object[]{"hello"})); assertTrue(ReflectUtils.isCompatible(new Class[]{double.class}, new Object[]{1.2})); } @Test - public void testGetCodeBase() throws Exception { + void testGetCodeBase() throws Exception { assertNull(ReflectUtils.getCodeBase(null)); assertNull(ReflectUtils.getCodeBase(String.class)); assertNotNull(ReflectUtils.getCodeBase(ReflectUtils.class)); } @Test - public void testGetName() throws Exception { + void testGetName() throws Exception { // getName assertEquals("boolean", ReflectUtils.getName(boolean.class)); assertEquals("int[][][]", ReflectUtils.getName(int[][][].class)); @@ -131,12 +131,12 @@ public class ReflectUtilsTest { } @Test - public void testGetGenericClass() throws Exception { + void testGetGenericClass() throws Exception { assertThat(ReflectUtils.getGenericClass(Foo1.class), sameInstance(String.class)); } @Test - public void testGetGenericClassWithIndex() throws Exception { + void testGetGenericClassWithIndex() throws Exception { assertThat(ReflectUtils.getGenericClass(Foo1.class, 0), sameInstance(String.class)); assertThat(ReflectUtils.getGenericClass(Foo1.class, 1), sameInstance(Integer.class)); assertThat(ReflectUtils.getGenericClass(Foo2.class, 0), sameInstance(List.class)); @@ -146,25 +146,25 @@ public class ReflectUtilsTest { } @Test - public void testGetMethodName() throws Exception { + void testGetMethodName() throws Exception { assertThat(ReflectUtils.getName(Foo2.class.getDeclaredMethod("hello", int[].class)), equalTo("java.util.List hello(int[])")); } @Test - public void testGetSignature() throws Exception { + void testGetSignature() throws Exception { Method m = Foo2.class.getDeclaredMethod("hello", int[].class); assertThat(ReflectUtils.getSignature("greeting", m.getParameterTypes()), equalTo("greeting([I)")); } @Test - public void testGetConstructorName() throws Exception { + void testGetConstructorName() throws Exception { Constructor c = Foo2.class.getConstructors()[0]; assertThat(ReflectUtils.getName(c), equalTo("(java.util.List,int[])")); } @Test - public void testName2Class() throws Exception { + void testName2Class() throws Exception { assertEquals(boolean.class, ReflectUtils.name2class("boolean")); assertEquals(boolean[].class, ReflectUtils.name2class("boolean[]")); assertEquals(int[][].class, ReflectUtils.name2class(ReflectUtils.getName(int[][].class))); @@ -172,29 +172,29 @@ public class ReflectUtilsTest { } @Test - public void testGetDescMethod() throws Exception { + void testGetDescMethod() throws Exception { assertThat(ReflectUtils.getDesc(Foo2.class.getDeclaredMethod("hello", int[].class)), equalTo("hello([I)Ljava/util/List;")); } @Test - public void testGetDescConstructor() throws Exception { + void testGetDescConstructor() throws Exception { assertThat(ReflectUtils.getDesc(Foo2.class.getConstructors()[0]), equalTo("(Ljava/util/List;[I)V")); } @Test - public void testGetDescWithoutMethodName() throws Exception { + void testGetDescWithoutMethodName() throws Exception { assertThat(ReflectUtils.getDescWithoutMethodName(Foo2.class.getDeclaredMethod("hello", int[].class)), equalTo("([I)Ljava/util/List;")); } @Test - public void testFindMethodByMethodName1() throws Exception { + void testFindMethodByMethodName1() throws Exception { assertNotNull(ReflectUtils.findMethodByMethodName(Foo.class, "hello")); } @Test - public void testFindMethodByMethodName2() { + void testFindMethodByMethodName2() { Assertions.assertThrows(IllegalStateException.class, () -> { ReflectUtils.findMethodByMethodName(Foo2.class, "hello"); }); @@ -202,18 +202,18 @@ public class ReflectUtilsTest { } @Test - public void testFindConstructor() throws Exception { + void testFindConstructor() throws Exception { Constructor constructor = ReflectUtils.findConstructor(Foo3.class, Foo2.class); assertNotNull(constructor); } @Test - public void testIsInstance() throws Exception { + void testIsInstance() throws Exception { assertTrue(ReflectUtils.isInstance(new Foo1(), Foo.class.getName())); } @Test - public void testIsBeanPropertyReadMethod() throws Exception { + void testIsBeanPropertyReadMethod() throws Exception { Method method = EmptyClass.class.getMethod("getProperty"); assertTrue(ReflectUtils.isBeanPropertyReadMethod(method)); method = EmptyClass.class.getMethod("getProperties"); @@ -225,7 +225,7 @@ public class ReflectUtilsTest { } @Test - public void testGetPropertyNameFromBeanReadMethod() throws Exception { + void testGetPropertyNameFromBeanReadMethod() throws Exception { Method method = EmptyClass.class.getMethod("getProperty"); assertEquals(ReflectUtils.getPropertyNameFromBeanReadMethod(method), "property"); method = EmptyClass.class.getMethod("isSet"); @@ -233,7 +233,7 @@ public class ReflectUtilsTest { } @Test - public void testIsBeanPropertyWriteMethod() throws Exception { + void testIsBeanPropertyWriteMethod() throws Exception { Method method = EmptyClass.class.getMethod("setProperty", EmptyProperty.class); assertTrue(ReflectUtils.isBeanPropertyWriteMethod(method)); method = EmptyClass.class.getMethod("setSet", boolean.class); @@ -241,13 +241,13 @@ public class ReflectUtilsTest { } @Test - public void testGetPropertyNameFromBeanWriteMethod() throws Exception { + void testGetPropertyNameFromBeanWriteMethod() throws Exception { Method method = EmptyClass.class.getMethod("setProperty", EmptyProperty.class); assertEquals(ReflectUtils.getPropertyNameFromBeanWriteMethod(method), "property"); } @Test - public void testIsPublicInstanceField() throws Exception { + void testIsPublicInstanceField() throws Exception { Field field = EmptyClass.class.getDeclaredField("set"); assertTrue(ReflectUtils.isPublicInstanceField(field)); field = EmptyClass.class.getDeclaredField("property"); @@ -255,7 +255,7 @@ public class ReflectUtilsTest { } @Test - public void testGetBeanPropertyFields() throws Exception { + void testGetBeanPropertyFields() throws Exception { Map map = ReflectUtils.getBeanPropertyFields(EmptyClass.class); assertThat(map.size(), is(2)); assertThat(map, hasKey("set")); @@ -268,7 +268,7 @@ public class ReflectUtilsTest { } @Test - public void testGetBeanPropertyReadMethods() throws Exception { + void testGetBeanPropertyReadMethods() throws Exception { Map map = ReflectUtils.getBeanPropertyReadMethods(EmptyClass.class); assertThat(map.size(), is(2)); assertThat(map, hasKey("set")); @@ -281,7 +281,7 @@ public class ReflectUtilsTest { } @Test - public void testDesc2Class() throws Exception { + void testDesc2Class() throws Exception { assertEquals(void.class, ReflectUtils.desc2class("V")); assertEquals(boolean.class, ReflectUtils.desc2class("Z")); assertEquals(boolean[].class, ReflectUtils.desc2class("[Z")); @@ -319,7 +319,7 @@ public class ReflectUtilsTest { } @Test - public void testFindMethodByMethodSignature() throws Exception { + void testFindMethodByMethodSignature() throws Exception { Method m = ReflectUtils.findMethodByMethodSignature(TestedClass.class, "method1", null); assertEquals("method1", m.getName()); @@ -329,7 +329,7 @@ public class ReflectUtilsTest { } @Test - public void testFindMethodByMethodSignature_override() throws Exception { + void testFindMethodByMethodSignature_override() throws Exception { { Method m = ReflectUtils.findMethodByMethodSignature(TestedClass.class, "overrideMethod", new String[]{"int"}); @@ -351,7 +351,7 @@ public class ReflectUtilsTest { } @Test - public void testFindMethodByMethodSignatureOverrideMoreThan1() throws Exception { + void testFindMethodByMethodSignatureOverrideMoreThan1() throws Exception { try { ReflectUtils.findMethodByMethodSignature(TestedClass.class, "overrideMethod", null); fail(); @@ -361,7 +361,7 @@ public class ReflectUtilsTest { } @Test - public void testFindMethodByMethodSignatureNotFound() throws Exception { + void testFindMethodByMethodSignatureNotFound() throws Exception { try { ReflectUtils.findMethodByMethodSignature(TestedClass.class, "notExsited", null); fail(); @@ -372,7 +372,7 @@ public class ReflectUtilsTest { } @Test - public void testGetEmptyObject() throws Exception { + void testGetEmptyObject() throws Exception { assertTrue(ReflectUtils.getEmptyObject(Collection.class) instanceof Collection); assertTrue(ReflectUtils.getEmptyObject(List.class) instanceof List); assertTrue(ReflectUtils.getEmptyObject(Set.class) instanceof Set); @@ -393,19 +393,19 @@ public class ReflectUtilsTest { } @Test - public void testForName1() throws Exception { + void testForName1() throws Exception { assertThat(ReflectUtils.forName(ReflectUtils.class.getName()), sameInstance(ReflectUtils.class)); } @Test - public void testForName2() { + void testForName2() { Assertions.assertThrows(IllegalStateException.class, () -> { ReflectUtils.forName("a.c.d.e.F"); }); } @Test - public void testGetReturnTypes () throws Exception{ + void testGetReturnTypes () throws Exception{ Class clazz = TypeClass.class; Type[] types = ReflectUtils.getReturnTypes(clazz.getMethod("getFuture")); @@ -544,4 +544,4 @@ public class ReflectUtilsTest { } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/RegexPropertiesTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/RegexPropertiesTest.java index 395b032b22..8afcb0dff1 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/RegexPropertiesTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/RegexPropertiesTest.java @@ -19,9 +19,9 @@ package org.apache.dubbo.common.utils; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class RegexPropertiesTest { +class RegexPropertiesTest { @Test - public void testGetProperty(){ + void testGetProperty(){ RegexProperties regexProperties = new RegexProperties(); regexProperties.setProperty("org.apache.dubbo.provider.*", "http://localhost:20880"); regexProperties.setProperty("org.apache.dubbo.provider.config.*", "http://localhost:30880"); @@ -35,4 +35,4 @@ public class RegexPropertiesTest { Assertions.assertEquals("http://localhost:50880", regexProperties.getProperty("org.apache.dubbo.consumer.service.demo")); Assertions.assertEquals("http://localhost:60880", regexProperties.getProperty("org.apache.dubbo.service")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/SerializeClassCheckerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/SerializeClassCheckerTest.java index b637923d28..0ffd6546c3 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/SerializeClassCheckerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/SerializeClassCheckerTest.java @@ -19,9 +19,9 @@ package org.apache.dubbo.common.utils; import org.apache.dubbo.common.constants.CommonConstants; import javassist.compiler.Javac; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; import java.net.Socket; @@ -29,7 +29,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Locale; -public class SerializeClassCheckerTest { +class SerializeClassCheckerTest { @BeforeEach public void setUp() { @@ -42,7 +42,7 @@ public class SerializeClassCheckerTest { } @Test - public void testCommon() { + void testCommon() { SerializeClassChecker serializeClassChecker = SerializeClassChecker.getInstance(); for (int i = 0; i < 10; i++) { @@ -63,7 +63,7 @@ public class SerializeClassCheckerTest { } @Test - public void testAddAllow() { + void testAddAllow() { System.setProperty(CommonConstants.CLASS_DESERIALIZE_ALLOWED_LIST, Socket.class.getName() + "," + Javac.class.getName()); SerializeClassChecker serializeClassChecker = SerializeClassChecker.getInstance(); @@ -76,7 +76,7 @@ public class SerializeClassCheckerTest { } @Test - public void testAddBlock() { + void testAddBlock() { System.setProperty(CommonConstants.CLASS_DESERIALIZE_BLOCKED_LIST, LinkedList.class.getName() + "," + Integer.class.getName()); SerializeClassChecker serializeClassChecker = SerializeClassChecker.getInstance(); @@ -93,7 +93,7 @@ public class SerializeClassCheckerTest { } @Test - public void testBlockAll() { + void testBlockAll() { System.setProperty(CommonConstants.CLASS_DESERIALIZE_BLOCK_ALL, "true"); System.setProperty(CommonConstants.CLASS_DESERIALIZE_ALLOWED_LIST, LinkedList.class.getName()); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StackTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StackTest.java index a51bc783e0..80d4109952 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StackTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StackTest.java @@ -26,9 +26,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; -public class StackTest { +class StackTest { @Test - public void testOps() throws Exception { + void testOps() throws Exception { Stack stack = new Stack(); stack.push("one"); assertThat(stack.get(0), equalTo("one")); @@ -49,7 +49,7 @@ public class StackTest { } @Test - public void testClear() throws Exception { + void testClear() throws Exception { Stack stack = new Stack(); stack.push("one"); stack.push("two"); @@ -59,7 +59,7 @@ public class StackTest { } @Test - public void testIllegalPop() throws Exception { + void testIllegalPop() throws Exception { Assertions.assertThrows(EmptyStackException.class, () -> { Stack stack = new Stack(); stack.pop(); @@ -67,7 +67,7 @@ public class StackTest { } @Test - public void testIllegalPeek() throws Exception { + void testIllegalPeek() throws Exception { Assertions.assertThrows(EmptyStackException.class, () -> { Stack stack = new Stack(); stack.peek(); @@ -75,7 +75,7 @@ public class StackTest { } @Test - public void testIllegalGet() throws Exception { + void testIllegalGet() throws Exception { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { Stack stack = new Stack(); stack.get(1); @@ -83,7 +83,7 @@ public class StackTest { } @Test - public void testIllegalGetNegative() throws Exception { + void testIllegalGetNegative() throws Exception { Stack stack = new Stack(); stack.push("one"); stack.get(-1); @@ -94,7 +94,7 @@ public class StackTest { } @Test - public void testIllegalSet() throws Exception { + void testIllegalSet() throws Exception { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { Stack stack = new Stack(); stack.set(1, "illegal"); @@ -102,7 +102,7 @@ public class StackTest { } @Test - public void testIllegalSetNegative() throws Exception { + void testIllegalSetNegative() throws Exception { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { Stack stack = new Stack(); stack.set(-1, "illegal"); @@ -110,7 +110,7 @@ public class StackTest { } @Test - public void testIllegalRemove() throws Exception { + void testIllegalRemove() throws Exception { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { Stack stack = new Stack(); stack.remove(1); @@ -118,7 +118,7 @@ public class StackTest { } @Test - public void testIllegalRemoveNegative() throws Exception { + void testIllegalRemoveNegative() throws Exception { Stack stack = new Stack(); stack.push("one"); @@ -126,4 +126,4 @@ public class StackTest { stack.remove(-2); }); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StringConstantFieldValuePredicateTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StringConstantFieldValuePredicateTest.java index 061854296f..c788d8f7e3 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StringConstantFieldValuePredicateTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StringConstantFieldValuePredicateTest.java @@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.8 */ -public class StringConstantFieldValuePredicateTest { +class StringConstantFieldValuePredicateTest { public static final String S1 = "1"; @@ -38,10 +38,10 @@ public class StringConstantFieldValuePredicateTest { public static final Object O2 = 3; @Test - public void test() { + void test() { Predicate predicate = of(getClass()); assertTrue(predicate.test("1")); assertTrue(predicate.test("2")); assertFalse(predicate.test("3")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StringUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StringUtilsTest.java index 043ac40eb7..5d46c2ad18 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StringUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/StringUtilsTest.java @@ -48,15 +48,15 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class StringUtilsTest { +class StringUtilsTest { @Test - public void testLength() throws Exception { + void testLength() throws Exception { assertThat(StringUtils.length(null), equalTo(0)); assertThat(StringUtils.length("abc"), equalTo(3)); } @Test - public void testRepeat() throws Exception { + void testRepeat() throws Exception { assertThat(StringUtils.repeat(null, 2), nullValue()); assertThat(StringUtils.repeat("", 0), equalTo("")); assertThat(StringUtils.repeat("", 2), equalTo("")); @@ -74,7 +74,7 @@ public class StringUtilsTest { } @Test - public void testStripEnd() throws Exception { + void testStripEnd() throws Exception { assertThat(StringUtils.stripEnd(null, "*"), nullValue()); assertThat(StringUtils.stripEnd("", null), equalTo("")); assertThat(StringUtils.stripEnd("abc", ""), equalTo("abc")); @@ -87,7 +87,7 @@ public class StringUtilsTest { } @Test - public void testReplace() throws Exception { + void testReplace() throws Exception { assertThat(StringUtils.replace(null, "*", "*"), nullValue()); assertThat(StringUtils.replace("", "*", "*"), equalTo("")); assertThat(StringUtils.replace("any", null, "*"), equalTo("any")); @@ -110,21 +110,21 @@ public class StringUtilsTest { } @Test - public void testIsBlank() throws Exception { + void testIsBlank() throws Exception { assertTrue(StringUtils.isBlank(null)); assertTrue(StringUtils.isBlank("")); assertFalse(StringUtils.isBlank("abc")); } @Test - public void testIsEmpty() throws Exception { + void testIsEmpty() throws Exception { assertTrue(StringUtils.isEmpty(null)); assertTrue(StringUtils.isEmpty("")); assertFalse(StringUtils.isEmpty("abc")); } @Test - public void testIsNoneEmpty() throws Exception { + void testIsNoneEmpty() throws Exception { assertFalse(StringUtils.isNoneEmpty(null)); assertFalse(StringUtils.isNoneEmpty("")); assertTrue(StringUtils.isNoneEmpty(" ")); @@ -136,7 +136,7 @@ public class StringUtilsTest { } @Test - public void testIsAnyEmpty() throws Exception { + void testIsAnyEmpty() throws Exception { assertTrue(StringUtils.isAnyEmpty(null)); assertTrue(StringUtils.isAnyEmpty("")); assertFalse(StringUtils.isAnyEmpty(" ")); @@ -148,14 +148,14 @@ public class StringUtilsTest { } @Test - public void testIsNotEmpty() throws Exception { + void testIsNotEmpty() throws Exception { assertFalse(StringUtils.isNotEmpty(null)); assertFalse(StringUtils.isNotEmpty("")); assertTrue(StringUtils.isNotEmpty("abc")); } @Test - public void testIsEquals() throws Exception { + void testIsEquals() throws Exception { assertTrue(StringUtils.isEquals(null, null)); assertFalse(StringUtils.isEquals(null, "")); assertTrue(StringUtils.isEquals("abc", "abc")); @@ -163,20 +163,20 @@ public class StringUtilsTest { } @Test - public void testIsInteger() throws Exception { + void testIsInteger() throws Exception { assertFalse(StringUtils.isNumber(null)); assertFalse(StringUtils.isNumber("")); assertTrue(StringUtils.isNumber("123")); } @Test - public void testParseInteger() throws Exception { + void testParseInteger() throws Exception { assertThat(StringUtils.parseInteger(null), equalTo(0)); assertThat(StringUtils.parseInteger("123"), equalTo(123)); } @Test - public void testIsJavaIdentifier() throws Exception { + void testIsJavaIdentifier() throws Exception { assertThat(StringUtils.isJavaIdentifier(""), is(false)); assertThat(StringUtils.isJavaIdentifier("1"), is(false)); assertThat(StringUtils.isJavaIdentifier("abc123"), is(true)); @@ -184,26 +184,26 @@ public class StringUtilsTest { } @Test - public void testExceptionToString() throws Exception { + void testExceptionToString() throws Exception { assertThat(StringUtils.toString(new RuntimeException("abc")), containsString("java.lang.RuntimeException: abc")); } @Test - public void testExceptionToStringWithMessage() throws Exception { + void testExceptionToStringWithMessage() throws Exception { String s = StringUtils.toString("greeting", new RuntimeException("abc")); assertThat(s, containsString("greeting")); assertThat(s, containsString("java.lang.RuntimeException: abc")); } @Test - public void testParseQueryString() throws Exception { + void testParseQueryString() throws Exception { assertThat(StringUtils.getQueryStringValue("key1=value1&key2=value2", "key1"), equalTo("value1")); assertThat(StringUtils.getQueryStringValue("key1=value1&key2=value2", "key2"), equalTo("value2")); assertThat(StringUtils.getQueryStringValue("", "key1"), isEmptyOrNullString()); } @Test - public void testGetServiceKey() throws Exception { + void testGetServiceKey() throws Exception { Map map = new HashMap(); map.put(GROUP_KEY, "dubbo"); map.put(INTERFACE_KEY, "a.b.c.Foo"); @@ -212,7 +212,7 @@ public class StringUtilsTest { } @Test - public void testToQueryString() throws Exception { + void testToQueryString() throws Exception { Map map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); @@ -222,7 +222,7 @@ public class StringUtilsTest { } @Test - public void testJoin() throws Exception { + void testJoin() throws Exception { String[] s = {"1", "2", "3"}; assertEquals(StringUtils.join(s), "123"); assertEquals(StringUtils.join(s, ','), "1,2,3"); @@ -230,7 +230,7 @@ public class StringUtilsTest { } @Test - public void testSplit() throws Exception { + void testSplit() throws Exception { String str = "d,1,2,4"; assertEquals(4, StringUtils.split(str, ',').length); @@ -247,7 +247,7 @@ public class StringUtilsTest { } @Test - public void testSplitToList() throws Exception { + void testSplitToList() throws Exception { String str = "d,1,2,4"; assertEquals(4, splitToList(str, ',').size()); @@ -266,7 +266,7 @@ public class StringUtilsTest { * @since 2.7.8 */ @Test - public void testSplitToSet() { + void testSplitToSet() { String value = "1# 2#3 #4#3"; Set values = splitToSet(value, '#', false); assertEquals(ofSet("1", " 2", "3 ", "4", "3"), values); @@ -277,14 +277,14 @@ public class StringUtilsTest { @Test - public void testTranslate() throws Exception { + void testTranslate() throws Exception { String s = "16314"; assertEquals(StringUtils.translate(s, "123456", "abcdef"), "afcad"); assertEquals(StringUtils.translate(s, "123456", "abcd"), "acad"); } @Test - public void testIsContains() throws Exception { + void testIsContains() throws Exception { assertThat(StringUtils.isContains("a,b, c", "b"), is(true)); assertThat(StringUtils.isContains("", "b"), is(false)); assertThat(StringUtils.isContains(new String[]{"a", "b", "c"}, "b"), is(true)); @@ -302,7 +302,7 @@ public class StringUtilsTest { } @Test - public void testIsNumeric() throws Exception { + void testIsNumeric() throws Exception { assertThat(StringUtils.isNumeric("123", false), is(true)); assertThat(StringUtils.isNumeric("1a3", false), is(false)); assertThat(StringUtils.isNumeric(null, false), is(false)); @@ -322,7 +322,7 @@ public class StringUtilsTest { } @Test - public void testJoinCollectionString() throws Exception { + void testJoinCollectionString() throws Exception { List list = new ArrayList(); assertEquals("", StringUtils.join(list, ",")); @@ -336,7 +336,7 @@ public class StringUtilsTest { } @Test - public void testCamelToSplitName() throws Exception { + void testCamelToSplitName() throws Exception { assertEquals("ab-cd-ef", StringUtils.camelToSplitName("abCdEf", "-")); assertEquals("ab-cd-ef", StringUtils.camelToSplitName("AbCdEf", "-")); assertEquals("abcdef", StringUtils.camelToSplitName("abcdef", "-")); @@ -352,7 +352,7 @@ public class StringUtilsTest { } @Test - public void testSnakeCaseToSplitName() throws Exception { + void testSnakeCaseToSplitName() throws Exception { assertEquals("ab-cd-ef", StringUtils.snakeToSplitName("ab_Cd_Ef", "-")); assertEquals("ab-cd-ef", StringUtils.snakeToSplitName("Ab_Cd_Ef", "-")); assertEquals("ab-cd-ef", StringUtils.snakeToSplitName("ab_cd_ef", "-")); @@ -363,7 +363,7 @@ public class StringUtilsTest { } @Test - public void testConvertToSplitName() { + void testConvertToSplitName() { assertEquals("ab-cd-ef", StringUtils.convertToSplitName("ab_Cd_Ef", "-")); assertEquals("ab-cd-ef", StringUtils.convertToSplitName("Ab_Cd_Ef", "-")); assertEquals("ab-cd-ef", StringUtils.convertToSplitName("ab_cd_ef", "-")); @@ -380,7 +380,7 @@ public class StringUtilsTest { } @Test - public void testToArgumentString() throws Exception { + void testToArgumentString() throws Exception { String s = StringUtils.toArgumentString(new Object[]{"a", 0, Collections.singletonMap("enabled", true)}); assertThat(s, containsString("a,")); assertThat(s, containsString("0,")); @@ -388,20 +388,20 @@ public class StringUtilsTest { } @Test - public void testTrim() { + void testTrim() { assertEquals("left blank", StringUtils.trim(" left blank")); assertEquals("right blank", StringUtils.trim("right blank ")); assertEquals("bi-side blank", StringUtils.trim(" bi-side blank ")); } @Test - public void testToURLKey() { + void testToURLKey() { assertEquals("dubbo.tag1", StringUtils.toURLKey("dubbo_tag1")); assertEquals("dubbo.tag1.tag11", StringUtils.toURLKey("dubbo-tag1_tag11")); } @Test - public void testToOSStyleKey() { + void testToOSStyleKey() { assertEquals("DUBBO_TAG1", StringUtils.toOSStyleKey("dubbo_tag1")); assertEquals("DUBBO_TAG1", StringUtils.toOSStyleKey("dubbo.tag1")); assertEquals("DUBBO_TAG1_TAG11", StringUtils.toOSStyleKey("dubbo.tag1.tag11")); @@ -409,7 +409,7 @@ public class StringUtilsTest { } @Test - public void testParseParameters() { + void testParseParameters() { String legalStr = "[{key1:value1},{key2:value2}]"; Map legalMap = StringUtils.parseParameters(legalStr); assertEquals(2, legalMap.size()); @@ -448,7 +448,7 @@ public class StringUtilsTest { } @Test - public void testEncodeParameters() { + void testEncodeParameters() { Map nullValueMap = new LinkedHashMap<>(); nullValueMap.put("client", null); String str = StringUtils.encodeParameters(nullValueMap); @@ -475,7 +475,7 @@ public class StringUtilsTest { * @since 2.7.8 */ @Test - public void testToCommaDelimitedString() { + void testToCommaDelimitedString() { String value = toCommaDelimitedString(null); assertNull(value); @@ -496,10 +496,10 @@ public class StringUtilsTest { } @Test - public void testStartsWithIgnoreCase() { + void testStartsWithIgnoreCase() { assertTrue(startsWithIgnoreCase("dubbo.application.name", "dubbo.application.")); assertTrue(startsWithIgnoreCase("dubbo.Application.name", "dubbo.application.")); assertTrue(startsWithIgnoreCase("Dubbo.application.name", "dubbo.application.")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java index 948bce438e..b82be418f6 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java @@ -37,12 +37,12 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class UrlUtilsTest { +class UrlUtilsTest { String localAddress = "127.0.0.1"; @Test - public void testAddressNull() { + void testAddressNull() { String exceptionMessage = "Address is not allowed to be empty, please re-enter."; try { UrlUtils.parseURL(null, null); @@ -52,7 +52,7 @@ public class UrlUtilsTest { } @Test - public void testParseUrl() { + void testParseUrl() { String address = "remote://root:alibaba@127.0.0.1:9090/dubbo.test.api"; URL url = UrlUtils.parseURL(address, null); assertEquals(localAddress + ":9090", url.getAddress()); @@ -64,13 +64,13 @@ public class UrlUtilsTest { } @Test - public void testParseURLWithSpecial() { + void testParseURLWithSpecial() { String address = "127.0.0.1:2181?backup=127.0.0.1:2182,127.0.0.1:2183"; assertEquals("dubbo://" + address, UrlUtils.parseURL(address, null).toString()); } @Test - public void testDefaultUrl() { + void testDefaultUrl() { String address = "127.0.0.1"; URL url = UrlUtils.parseURL(address, null); assertEquals(localAddress + ":9090", url.getAddress()); @@ -82,7 +82,7 @@ public class UrlUtilsTest { } @Test - public void testParseFromParameter() { + void testParseFromParameter() { String address = "127.0.0.1"; Map parameters = new HashMap(); parameters.put("username", "root"); @@ -104,7 +104,7 @@ public class UrlUtilsTest { } @Test - public void testParseUrl2() { + void testParseUrl2() { String address = "192.168.0.1"; String backupAddress1 = "192.168.0.2"; String backupAddress2 = "192.168.0.3"; @@ -124,7 +124,7 @@ public class UrlUtilsTest { } @Test - public void testParseUrls() { + void testParseUrls() { String addresses = "192.168.0.1|192.168.0.2|192.168.0.3"; Map parameters = new HashMap(); parameters.put("username", "root"); @@ -137,7 +137,7 @@ public class UrlUtilsTest { } @Test - public void testParseUrlsAddressNull() { + void testParseUrlsAddressNull() { String exceptionMessage = "Address is not allowed to be empty, please re-enter."; try { UrlUtils.parseURLs(null, null); @@ -147,7 +147,7 @@ public class UrlUtilsTest { } @Test - public void testConvertRegister() { + void testConvertRegister() { String key = "perf/dubbo.test.api.HelloService:1.0.0"; Map> register = new HashMap>(); register.put(key, null); @@ -156,7 +156,7 @@ public class UrlUtilsTest { } @Test - public void testConvertRegister2() { + void testConvertRegister2() { String key = "dubbo.test.api.HelloService"; Map> register = new HashMap>(); Map service = new HashMap(); @@ -169,7 +169,7 @@ public class UrlUtilsTest { } @Test - public void testSubscribe() { + void testSubscribe() { String key = "perf/dubbo.test.api.HelloService:1.0.0"; Map subscribe = new HashMap(); subscribe.put(key, null); @@ -178,7 +178,7 @@ public class UrlUtilsTest { } @Test - public void testSubscribe2() { + void testSubscribe2() { String key = "dubbo.test.api.HelloService"; Map subscribe = new HashMap(); subscribe.put(key, "version=1.0.0&group=test&dubbo.version=2.0.0"); @@ -187,7 +187,7 @@ public class UrlUtilsTest { } @Test - public void testRevertRegister() { + void testRevertRegister() { String key = "perf/dubbo.test.api.HelloService:1.0.0"; Map> register = new HashMap>(); Map service = new HashMap(); @@ -201,7 +201,7 @@ public class UrlUtilsTest { } @Test - public void testRevertRegister2() { + void testRevertRegister2() { String key = "dubbo.test.api.HelloService"; Map> register = new HashMap>(); Map service = new HashMap(); @@ -215,7 +215,7 @@ public class UrlUtilsTest { } @Test - public void testRevertSubscribe() { + void testRevertSubscribe() { String key = "perf/dubbo.test.api.HelloService:1.0.0"; Map subscribe = new HashMap(); subscribe.put(key, null); @@ -226,7 +226,7 @@ public class UrlUtilsTest { } @Test - public void testRevertSubscribe2() { + void testRevertSubscribe2() { String key = "dubbo.test.api.HelloService"; Map subscribe = new HashMap(); subscribe.put(key, null); @@ -235,7 +235,7 @@ public class UrlUtilsTest { } @Test - public void testRevertNotify() { + void testRevertNotify() { String key = "dubbo.test.api.HelloService"; Map> notify = new HashMap>(); Map service = new HashMap(); @@ -249,7 +249,7 @@ public class UrlUtilsTest { } @Test - public void testRevertNotify2() { + void testRevertNotify2() { String key = "perf/dubbo.test.api.HelloService:1.0.0"; Map> notify = new HashMap>(); Map service = new HashMap(); @@ -264,7 +264,7 @@ public class UrlUtilsTest { // backward compatibility for version 2.0.0 @Test - public void testRevertForbid() { + void testRevertForbid() { String service = "dubbo.test.api.HelloService"; List forbid = new ArrayList(); forbid.add(service); @@ -277,13 +277,13 @@ public class UrlUtilsTest { } @Test - public void testRevertForbid2() { + void testRevertForbid2() { List newForbid = UrlUtils.revertForbid(null, null); assertNull(newForbid); } @Test - public void testRevertForbid3() { + void testRevertForbid3() { String service1 = "dubbo.test.api.HelloService:1.0.0"; String service2 = "dubbo.test.api.HelloService:2.0.0"; List forbid = new ArrayList(); @@ -294,42 +294,42 @@ public class UrlUtilsTest { } @Test - public void testIsMatch() { + void testIsMatch() { URL consumerUrl = URL.valueOf("dubbo://127.0.0.1:20880/com.xxx.XxxService?version=1.0.0&group=test"); URL providerUrl = URL.valueOf("http://127.0.0.1:8080/com.xxx.XxxService?version=1.0.0&group=test"); assertTrue(UrlUtils.isMatch(consumerUrl, providerUrl)); } @Test - public void testIsMatch2() { + void testIsMatch2() { URL consumerUrl = URL.valueOf("dubbo://127.0.0.1:20880/com.xxx.XxxService?version=2.0.0&group=test"); URL providerUrl = URL.valueOf("http://127.0.0.1:8080/com.xxx.XxxService?version=1.0.0&group=test"); assertFalse(UrlUtils.isMatch(consumerUrl, providerUrl)); } @Test - public void testIsMatch3() { + void testIsMatch3() { URL consumerUrl = URL.valueOf("dubbo://127.0.0.1:20880/com.xxx.XxxService?version=1.0.0&group=aa"); URL providerUrl = URL.valueOf("http://127.0.0.1:8080/com.xxx.XxxService?version=1.0.0&group=test"); assertFalse(UrlUtils.isMatch(consumerUrl, providerUrl)); } @Test - public void testIsMatch4() { + void testIsMatch4() { URL consumerUrl = URL.valueOf("dubbo://127.0.0.1:20880/com.xxx.XxxService?version=1.0.0&group=*"); URL providerUrl = URL.valueOf("http://127.0.0.1:8080/com.xxx.XxxService?version=1.0.0&group=test"); assertTrue(UrlUtils.isMatch(consumerUrl, providerUrl)); } @Test - public void testIsMatch5() { + void testIsMatch5() { URL consumerUrl = URL.valueOf("dubbo://127.0.0.1:20880/com.xxx.XxxService?version=*&group=test"); URL providerUrl = URL.valueOf("http://127.0.0.1:8080/com.xxx.XxxService?version=1.0.0&group=test"); assertTrue(UrlUtils.isMatch(consumerUrl, providerUrl)); } @Test - public void testIsItemMatch() throws Exception { + void testIsItemMatch() throws Exception { assertTrue(UrlUtils.isItemMatch(null, null)); assertTrue(!UrlUtils.isItemMatch("1", null)); assertTrue(!UrlUtils.isItemMatch(null, "1")); @@ -341,7 +341,7 @@ public class UrlUtilsTest { } @Test - public void testIsServiceKeyMatch() throws Exception { + void testIsServiceKeyMatch() throws Exception { URL url = URL.valueOf("test://127.0.0.1"); URL pattern = url.addParameter(GROUP_KEY, "test") .addParameter(INTERFACE_KEY, "test") @@ -357,13 +357,13 @@ public class UrlUtilsTest { } @Test - public void testGetEmptyUrl() throws Exception { + void testGetEmptyUrl() throws Exception { URL url = UrlUtils.getEmptyUrl("dubbo/a.b.c.Foo:1.0.0", "test"); assertThat(url.toFullString(), equalTo("empty://0.0.0.0/a.b.c.Foo?category=test&group=dubbo&version=1.0.0")); } @Test - public void testIsMatchGlobPattern() throws Exception { + void testIsMatchGlobPattern() throws Exception { assertTrue(UrlUtils.isMatchGlobPattern("*", "value")); assertTrue(UrlUtils.isMatchGlobPattern("", null)); assertFalse(UrlUtils.isMatchGlobPattern("", "value")); @@ -375,7 +375,7 @@ public class UrlUtilsTest { } @Test - public void testIsMatchUrlWithDefaultPrefix() { + void testIsMatchUrlWithDefaultPrefix() { URL url = URL.valueOf("dubbo://127.0.0.1:20880/com.xxx.XxxService?default.version=1.0.0&default.group=test"); assertEquals("1.0.0", url.getVersion()); assertEquals("1.0.0", url.getParameter("default.version")); @@ -386,4 +386,4 @@ public class UrlUtilsTest { URL consumerUrl1 = URL.valueOf("consumer://127.0.0.1/com.xxx.XxxService?default.version=1.0.0&default.group=test"); assertTrue(UrlUtils.isMatch(consumerUrl, url)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/version/VersionTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/version/VersionTest.java index 7311cc694e..39093a8d55 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/version/VersionTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/version/VersionTest.java @@ -22,15 +22,15 @@ import org.apache.dubbo.common.Version; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class VersionTest { +class VersionTest { @Test - public void testGetProtocolVersion() { + void testGetProtocolVersion() { Assertions.assertEquals(Version.getProtocolVersion(), Version.DEFAULT_DUBBO_PROTOCOL_VERSION); } @Test - public void testSupportResponseAttachment() { + void testSupportResponseAttachment() { Assertions.assertTrue(Version.isSupportResponseAttachment("2.0.2")); Assertions.assertTrue(Version.isSupportResponseAttachment("2.0.3")); Assertions.assertTrue(Version.isSupportResponseAttachment("2.0.99")); @@ -47,7 +47,7 @@ public class VersionTest { } @Test - public void testGetIntVersion() { + void testGetIntVersion() { Assertions.assertEquals(2060100, Version.getIntVersion("2.6.1")); Assertions.assertEquals(2060101, Version.getIntVersion("2.6.1.1")); Assertions.assertEquals(2070001, Version.getIntVersion("2.7.0.1")); @@ -60,7 +60,7 @@ public class VersionTest { } @Test - public void testCompare() { + void testCompare() { Assertions.assertEquals(0, Version.compare("3.0.0", "3.0.0")); Assertions.assertEquals(0, Version.compare("3.0.0-SNAPSHOT", "3.0.0")); Assertions.assertEquals(1, Version.compare("3.0.0.1", "3.0.0")); @@ -71,7 +71,7 @@ public class VersionTest { } @Test - public void testIsFramework270OrHigher() { + void testIsFramework270OrHigher() { Assertions.assertTrue(Version.isRelease270OrHigher("2.7.0")); Assertions.assertTrue(Version.isRelease270OrHigher("2.7.0.1")); Assertions.assertTrue(Version.isRelease270OrHigher("2.7.0.2")); @@ -81,7 +81,7 @@ public class VersionTest { } @Test - public void testIsFramework263OrHigher() { + void testIsFramework263OrHigher() { Assertions.assertTrue(Version.isRelease263OrHigher("2.7.0")); Assertions.assertTrue(Version.isRelease263OrHigher("2.7.0.1")); Assertions.assertTrue(Version.isRelease263OrHigher("2.6.4")); @@ -91,4 +91,4 @@ public class VersionTest { Assertions.assertTrue(Version.isRelease263OrHigher("2.6.3")); Assertions.assertTrue(Version.isRelease263OrHigher("2.6.3.0")); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java b/dubbo-common/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java index 5771e99349..a09ea89e21 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/config/AbstractInterfaceConfigTest.java @@ -29,7 +29,7 @@ import java.io.File; import java.nio.file.Path; import java.util.Collections; -public class AbstractInterfaceConfigTest { +class AbstractInterfaceConfigTest { @BeforeAll public static void setUp(@TempDir Path folder) { @@ -44,7 +44,7 @@ public class AbstractInterfaceConfigTest { @Test - public void checkStub1() { + void checkStub1() { Assertions.assertThrows(IllegalStateException.class, () -> { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setLocal(GreetingLocal1.class.getName()); @@ -53,7 +53,7 @@ public class AbstractInterfaceConfigTest { } @Test - public void checkStub2() { + void checkStub2() { Assertions.assertThrows(IllegalStateException.class, () -> { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setLocal(GreetingLocal2.class.getName()); @@ -62,14 +62,14 @@ public class AbstractInterfaceConfigTest { } @Test - public void checkStub3() { + void checkStub3() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setLocal(GreetingLocal3.class.getName()); interfaceConfig.checkStubAndLocal(Greeting.class); } @Test - public void checkStub4() { + void checkStub4() { Assertions.assertThrows(IllegalStateException.class, () -> { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setStub(GreetingLocal1.class.getName()); @@ -78,7 +78,7 @@ public class AbstractInterfaceConfigTest { } @Test - public void checkStub5() { + void checkStub5() { Assertions.assertThrows(IllegalStateException.class, () -> { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setStub(GreetingLocal2.class.getName()); @@ -87,14 +87,14 @@ public class AbstractInterfaceConfigTest { } @Test - public void checkStub6() { + void checkStub6() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setStub(GreetingLocal3.class.getName()); interfaceConfig.checkStubAndLocal(Greeting.class); } @Test - public void testLocal() { + void testLocal() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setLocal((Boolean) null); Assertions.assertNull(interfaceConfig.getLocal()); @@ -105,7 +105,7 @@ public class AbstractInterfaceConfigTest { } @Test - public void testStub() { + void testStub() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setStub((Boolean) null); Assertions.assertNull(interfaceConfig.getStub()); @@ -116,49 +116,49 @@ public class AbstractInterfaceConfigTest { } @Test - public void testCluster() { + void testCluster() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setCluster("mockcluster"); Assertions.assertEquals("mockcluster", interfaceConfig.getCluster()); } @Test - public void testProxy() { + void testProxy() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setProxy("mockproxyfactory"); Assertions.assertEquals("mockproxyfactory", interfaceConfig.getProxy()); } @Test - public void testConnections() { + void testConnections() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setConnections(1); Assertions.assertEquals(1, interfaceConfig.getConnections().intValue()); } @Test - public void testFilter() { + void testFilter() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setFilter("mockfilter"); Assertions.assertEquals("mockfilter", interfaceConfig.getFilter()); } @Test - public void testListener() { + void testListener() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setListener("mockinvokerlistener"); Assertions.assertEquals("mockinvokerlistener", interfaceConfig.getListener()); } @Test - public void testLayer() { + void testLayer() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setLayer("layer"); Assertions.assertEquals("layer", interfaceConfig.getLayer()); } @Test - public void testApplication() { + void testApplication() { InterfaceConfig interfaceConfig = new InterfaceConfig(); ApplicationConfig applicationConfig = new ApplicationConfig("AbstractInterfaceConfigTest"); interfaceConfig.setApplication(applicationConfig); @@ -166,7 +166,7 @@ public class AbstractInterfaceConfigTest { } @Test - public void testModule() { + void testModule() { InterfaceConfig interfaceConfig = new InterfaceConfig(); ModuleConfig moduleConfig = new ModuleConfig(); interfaceConfig.setModule(moduleConfig); @@ -174,7 +174,7 @@ public class AbstractInterfaceConfigTest { } @Test - public void testRegistry() { + void testRegistry() { InterfaceConfig interfaceConfig = new InterfaceConfig(); RegistryConfig registryConfig = new RegistryConfig(); interfaceConfig.setRegistry(registryConfig); @@ -182,7 +182,7 @@ public class AbstractInterfaceConfigTest { } @Test - public void testRegistries() { + void testRegistries() { InterfaceConfig interfaceConfig = new InterfaceConfig(); RegistryConfig registryConfig = new RegistryConfig(); interfaceConfig.setRegistries(Collections.singletonList(registryConfig)); @@ -191,7 +191,7 @@ public class AbstractInterfaceConfigTest { } @Test - public void testMonitor() { + void testMonitor() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setMonitor("monitor-addr"); Assertions.assertEquals("monitor-addr", interfaceConfig.getMonitor().getAddress()); @@ -202,35 +202,35 @@ public class AbstractInterfaceConfigTest { } @Test - public void testOwner() { + void testOwner() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setOwner("owner"); Assertions.assertEquals("owner", interfaceConfig.getOwner()); } @Test - public void testCallbacks() { + void testCallbacks() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setCallbacks(2); Assertions.assertEquals(2, interfaceConfig.getCallbacks().intValue()); } @Test - public void testOnconnect() { + void testOnconnect() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setOnconnect("onConnect"); Assertions.assertEquals("onConnect", interfaceConfig.getOnconnect()); } @Test - public void testOndisconnect() { + void testOndisconnect() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setOndisconnect("onDisconnect"); Assertions.assertEquals("onDisconnect", interfaceConfig.getOndisconnect()); } @Test - public void testScope() { + void testScope() { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setScope("scope"); Assertions.assertEquals("scope", interfaceConfig.getScope()); @@ -239,4 +239,4 @@ public class AbstractInterfaceConfigTest { public static class InterfaceConfig extends AbstractInterfaceConfig { } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigConfigurationAdapterTest.java b/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigConfigurationAdapterTest.java index 3a4a7ddbe5..826560831f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigConfigurationAdapterTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigConfigurationAdapterTest.java @@ -24,10 +24,10 @@ import org.junit.jupiter.api.Test; /** * {@link ConfigConfigurationAdapter} */ -public class ConfigConfigurationAdapterTest { +class ConfigConfigurationAdapterTest { @Test - public void test() { + void test() { RegistryConfig registryConfig = new RegistryConfig(); registryConfig.setAddress("127.0.0.1"); registryConfig.setPort(2181); @@ -38,4 +38,4 @@ public class ConfigConfigurationAdapterTest { Assertions.assertEquals(configConfigurationAdapter.getInternalProperty(prefix + "." + "address"), "127.0.0.1"); Assertions.assertEquals(configConfigurationAdapter.getInternalProperty(prefix + "." + "port"), "2181"); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigManagerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigManagerTest.java index 3a59d30ce0..aaa7fc604d 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigManagerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/config/context/ConfigManagerTest.java @@ -53,7 +53,7 @@ import static org.junit.jupiter.api.Assertions.fail; * * @since 2.7.5 */ -public class ConfigManagerTest { +class ConfigManagerTest { private ConfigManager configManager; private ModuleConfigManager moduleConfigManager; @@ -67,12 +67,12 @@ public class ConfigManagerTest { } @Test - public void testDestroy() { + void testDestroy() { assertTrue(configManager.configsCache.isEmpty()); } @Test - public void testDefaultValues() { + void testDefaultValues() { // assert single assertFalse(configManager.getApplication().isPresent()); assertFalse(configManager.getMonitor().isPresent()); @@ -106,7 +106,7 @@ public class ConfigManagerTest { // Test ApplicationConfig correlative methods @Test - public void testApplicationConfig() { + void testApplicationConfig() { ApplicationConfig config = new ApplicationConfig("ConfigManagerTest"); configManager.setApplication(config); assertTrue(configManager.getApplication().isPresent()); @@ -116,7 +116,7 @@ public class ConfigManagerTest { // Test MonitorConfig correlative methods @Test - public void testMonitorConfig() { + void testMonitorConfig() { MonitorConfig monitorConfig = new MonitorConfig(); monitorConfig.setGroup("test"); configManager.setMonitor(monitorConfig); @@ -127,7 +127,7 @@ public class ConfigManagerTest { // Test ModuleConfig correlative methods @Test - public void testModuleConfig() { + void testModuleConfig() { ModuleConfig config = new ModuleConfig(); moduleConfigManager.setModule(config); assertTrue(moduleConfigManager.getModule().isPresent()); @@ -136,7 +136,7 @@ public class ConfigManagerTest { // Test MetricsConfig correlative methods @Test - public void testMetricsConfig() { + void testMetricsConfig() { MetricsConfig config = new MetricsConfig(); config.setProtocol(PROTOCOL_PROMETHEUS); configManager.setMetrics(config); @@ -147,7 +147,7 @@ public class ConfigManagerTest { // Test ProviderConfig correlative methods @Test - public void testProviderConfig() { + void testProviderConfig() { ProviderConfig config = new ProviderConfig(); moduleConfigManager.addProviders(asList(config, null)); Collection configs = moduleConfigManager.getProviders(); @@ -166,7 +166,7 @@ public class ConfigManagerTest { // Test ConsumerConfig correlative methods @Test - public void testConsumerConfig() { + void testConsumerConfig() { ConsumerConfig config = new ConsumerConfig(); moduleConfigManager.addConsumers(asList(config, null)); Collection configs = moduleConfigManager.getConsumers(); @@ -185,7 +185,7 @@ public class ConfigManagerTest { // Test ProtocolConfig correlative methods @Test - public void testProtocolConfig() { + void testProtocolConfig() { ProtocolConfig config = new ProtocolConfig(); configManager.addProtocols(asList(config, null)); Collection configs = configManager.getProtocols(); @@ -205,7 +205,7 @@ public class ConfigManagerTest { // Test RegistryConfig correlative methods @Test - public void testRegistryConfig() { + void testRegistryConfig() { RegistryConfig config = new RegistryConfig(); configManager.addRegistries(asList(config, null)); Collection configs = configManager.getRegistries(); @@ -217,7 +217,7 @@ public class ConfigManagerTest { // Test ConfigCenterConfig correlative methods @Test - public void testConfigCenterConfig() { + void testConfigCenterConfig() { String address = "zookeeper://127.0.0.1:2181"; ConfigCenterConfig config = new ConfigCenterConfig(); config.setAddress(address); @@ -238,7 +238,7 @@ public class ConfigManagerTest { } @Test - public void testAddConfig() { + void testAddConfig() { configManager.addConfig(new ApplicationConfig("ConfigManagerTest")); configManager.addConfig(new ProtocolConfig()); moduleConfigManager.addConfig(new ProviderConfig()); @@ -249,13 +249,13 @@ public class ConfigManagerTest { } @Test - public void testRefreshAll() { + void testRefreshAll() { configManager.refreshAll(); moduleConfigManager.refreshAll(); } @Test - public void testDefaultConfig() { + void testDefaultConfig() { ProviderConfig providerConfig = new ProviderConfig(); providerConfig.setDefault(false); assertFalse(ConfigManager.isDefaultConfig(providerConfig)); @@ -273,7 +273,7 @@ public class ConfigManagerTest { } @Test - public void testConfigMode() { + void testConfigMode() { ApplicationConfig applicationConfig1 = new ApplicationConfig("app1"); ApplicationConfig applicationConfig2 = new ApplicationConfig("app2"); @@ -354,7 +354,7 @@ public class ConfigManagerTest { } @Test - public void testGetConfigByIdOrName() { + void testGetConfigByIdOrName() { RegistryConfig registryConfig = new RegistryConfig(); registryConfig.setId("registryID_1"); configManager.addRegistry(registryConfig); @@ -391,7 +391,7 @@ public class ConfigManagerTest { } @Test - public void testLoadConfigsOfTypeFromProps() { + void testLoadConfigsOfTypeFromProps() { try { // dubbo.application.enable-file-cache = false configManager.loadConfigsOfTypeFromProps(ApplicationConfig.class); @@ -427,7 +427,7 @@ public class ConfigManagerTest { } @Test - public void testLoadConfig() { + void testLoadConfig() { configManager.loadConfigs(); Assertions.assertTrue(configManager.getApplication().isPresent()); Assertions.assertTrue(configManager.getSsl().isPresent()); @@ -456,4 +456,4 @@ public class ConfigManagerTest { Assertions.assertFalse(moduleConfigManager.getConsumers().isEmpty()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/MetadataTest.java b/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/MetadataTest.java index 26106de36c..d06044c504 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/MetadataTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/MetadataTest.java @@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test; *

* 16/9/22. */ -public class MetadataTest { +class MetadataTest { @BeforeAll public static void setup() { @@ -46,7 +46,7 @@ public class MetadataTest { * */ @Test - public void testInnerClassType() { + void testInnerClassType() { TypeDefinitionBuilder builder = new TypeDefinitionBuilder(); TypeDefinition td = builder.build(OuterClass.InnerClass.class, OuterClass.InnerClass.class); System.out.println(">> testInnerClassType: " + JsonUtils.getJson().toJson(td)); @@ -73,7 +73,7 @@ public class MetadataTest { * */ @Test - public void testRawMap() { + void testRawMap() { TypeDefinitionBuilder builder = new TypeDefinitionBuilder(); TypeDefinition td = builder.build(ResultWithRawCollections.class, ResultWithRawCollections.class); System.out.println(">> testRawMap: " + JsonUtils.getJson().toJson(td)); @@ -99,7 +99,7 @@ public class MetadataTest { } @Test - public void testEnum() { + void testEnum() { TypeDefinitionBuilder builder = new TypeDefinitionBuilder(); TypeDefinition td = builder.build(ColorEnum.class, ColorEnum.class); System.out.println(">> testEnum: " + JsonUtils.getJson().toJson(td)); @@ -126,7 +126,7 @@ public class MetadataTest { } @Test - public void testExtendsMap() { + void testExtendsMap() { TypeDefinitionBuilder builder = new TypeDefinitionBuilder(); TypeDefinition td = builder.build(ClassExtendsMap.class, ClassExtendsMap.class); System.out.println(">> testExtendsMap: " + JsonUtils.getJson().toJson(td)); @@ -148,4 +148,4 @@ public class MetadataTest { } Assertions.assertFalse(containsType); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/ServiceDefinitionBuilderTest.java b/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/ServiceDefinitionBuilderTest.java index cc9c6f9c8b..1df9ebdcdf 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/ServiceDefinitionBuilderTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/ServiceDefinitionBuilderTest.java @@ -35,7 +35,7 @@ import java.util.List; /** * 2018/11/6 */ -public class ServiceDefinitionBuilderTest { +class ServiceDefinitionBuilderTest { private static FrameworkModel frameworkModel; @@ -52,7 +52,7 @@ public class ServiceDefinitionBuilderTest { } @Test - public void testBuilderComplexObject() { + void testBuilderComplexObject() { TypeDefinitionBuilder.initBuilders(FrameworkModel.defaultModel()); FullServiceDefinition fullServiceDefinition = ServiceDefinitionBuilder.buildFullDefinition(DemoService.class); checkComplexObjectAsParam(fullServiceDefinition); @@ -134,4 +134,4 @@ public class ServiceDefinitionBuilderTest { Assertions.assertEquals(Integer.class.getCanonicalName(), listTypeDefinition.getItems().get(0)); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilderTest.java b/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilderTest.java index e888703aa7..a88be015fe 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilderTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilderTest.java @@ -17,15 +17,15 @@ package org.apache.dubbo.metadata.definition; import org.apache.dubbo.metadata.definition.builder.TypeBuilder; - import org.apache.dubbo.rpc.model.FrameworkModel; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class TypeDefinitionBuilderTest { +class TypeDefinitionBuilderTest { @Test - public void testSortTypeBuilder() { + void testSortTypeBuilder() { TypeDefinitionBuilder.initBuilders(FrameworkModel.defaultModel()); TypeBuilder tb = TypeDefinitionBuilder.BUILDERS.get(0); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ApplicationModelTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ApplicationModelTest.java index d4120c96a8..318ab343c3 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ApplicationModelTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ApplicationModelTest.java @@ -30,10 +30,10 @@ import org.junit.jupiter.api.Test; /** * {@link ApplicationModel} */ -public class ApplicationModelTest { +class ApplicationModelTest { @Test - public void testInitialize() { + void testInitialize() { FrameworkModel frameworkModel = new FrameworkModel(); ApplicationModel applicationModel = new ApplicationModel(frameworkModel); @@ -60,7 +60,7 @@ public class ApplicationModelTest { } @Test - public void testDefaultApplication() { + void testDefaultApplication() { ApplicationModel applicationModel = ApplicationModel.defaultModel(); FrameworkModel frameworkModel = applicationModel.getFrameworkModel(); @@ -75,7 +75,7 @@ public class ApplicationModelTest { } @Test - public void testModule() { + void testModule() { FrameworkModel frameworkModel = new FrameworkModel(); ApplicationModel applicationModel = new ApplicationModel(frameworkModel); @@ -95,7 +95,7 @@ public class ApplicationModelTest { } @Test - public void testOfNullable() { + void testOfNullable() { ApplicationModel applicationModel = ApplicationModel.ofNullable(null); Assertions.assertEquals(ApplicationModel.defaultModel(), applicationModel); applicationModel.getFrameworkModel().destroy(); @@ -108,7 +108,7 @@ public class ApplicationModelTest { } @Test - public void testDestroy() { + void testDestroy() { FrameworkModel frameworkModel = new FrameworkModel(); ApplicationModel applicationModel = new ApplicationModel(frameworkModel); @@ -144,4 +144,4 @@ public class ApplicationModelTest { } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/FrameworkModelTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/FrameworkModelTest.java index 9ea6fb8fa0..5f9ff99901 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/FrameworkModelTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/FrameworkModelTest.java @@ -25,9 +25,9 @@ import org.junit.jupiter.api.Test; /** * {@link FrameworkModel} */ -public class FrameworkModelTest { +class FrameworkModelTest { @Test - public void testInitialize() { + void testInitialize() { FrameworkModel.destroyAll(); FrameworkModel frameworkModel = new FrameworkModel(); @@ -52,7 +52,7 @@ public class FrameworkModelTest { } @Test - public void testDefaultModel() { + void testDefaultModel() { FrameworkModel frameworkModel = FrameworkModel.defaultModel(); Assertions.assertTrue(FrameworkModel.getAllInstances().contains(frameworkModel)); String desc = frameworkModel.getDesc(); @@ -61,7 +61,7 @@ public class FrameworkModelTest { } @Test - public void testApplicationModel() { + void testApplicationModel() { FrameworkModel frameworkModel = new FrameworkModel(); ApplicationModel applicationModel = frameworkModel.defaultApplication(); @@ -81,7 +81,7 @@ public class FrameworkModelTest { } @Test - public void destroyAll() { + void destroyAll() { FrameworkModel frameworkModel = new FrameworkModel(); frameworkModel.defaultApplication(); frameworkModel.newApplication(); @@ -105,4 +105,4 @@ public class FrameworkModelTest { } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/FrameworkServiceRepositoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/FrameworkServiceRepositoryTest.java index 03742dbc7a..ce691994b4 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/FrameworkServiceRepositoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/FrameworkServiceRepositoryTest.java @@ -35,7 +35,7 @@ import static org.apache.dubbo.common.BaseServiceMetadata.versionFromServiceKey; /** * {@link FrameworkServiceRepository} */ -public class FrameworkServiceRepositoryTest { +class FrameworkServiceRepositoryTest { private FrameworkModel frameworkModel; private ApplicationModel applicationModel; private ModuleModel moduleModel; @@ -53,7 +53,7 @@ public class FrameworkServiceRepositoryTest { } @Test - public void test() { + void test() { FrameworkServiceRepository frameworkServiceRepository = frameworkModel.getServiceRepository(); ModuleServiceRepository moduleServiceRepository = moduleModel.getServiceRepository(); @@ -111,4 +111,4 @@ public class FrameworkServiceRepositoryTest { } return interfaceName + ":" + version; } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ModuleModelTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ModuleModelTest.java index c1b1c341bc..dc1d4115f9 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ModuleModelTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ModuleModelTest.java @@ -28,10 +28,10 @@ import org.junit.jupiter.api.Test; /** * {@link ModuleModel} */ -public class ModuleModelTest { +class ModuleModelTest { @Test - public void testInitialize() { + void testInitialize() { FrameworkModel frameworkModel = new FrameworkModel(); ApplicationModel applicationModel = new ApplicationModel(frameworkModel); ModuleModel moduleModel = new ModuleModel(applicationModel); @@ -56,7 +56,7 @@ public class ModuleModelTest { } @Test - public void testModelEnvironment() { + void testModelEnvironment() { FrameworkModel frameworkModel = new FrameworkModel(); ApplicationModel applicationModel = new ApplicationModel(frameworkModel); ModuleModel moduleModel = new ModuleModel(applicationModel); @@ -68,7 +68,7 @@ public class ModuleModelTest { } @Test - public void testDestroy() { + void testDestroy() { FrameworkModel frameworkModel = new FrameworkModel(); ApplicationModel applicationModel = new ApplicationModel(frameworkModel); ModuleModel moduleModel = new ModuleModel(applicationModel); @@ -88,4 +88,4 @@ public class ModuleModelTest { Assertions.assertTrue(frameworkModel.isDestroyed()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ModuleServiceRepositoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ModuleServiceRepositoryTest.java index a10bf7f250..17f15348fe 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ModuleServiceRepositoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ModuleServiceRepositoryTest.java @@ -30,7 +30,7 @@ import java.util.List; /** * {@link ModuleServiceRepository} */ -public class ModuleServiceRepositoryTest { +class ModuleServiceRepositoryTest { private FrameworkModel frameworkModel; private ApplicationModel applicationModel; @@ -49,7 +49,7 @@ public class ModuleServiceRepositoryTest { } @Test - public void test() { + void test() { ModuleServiceRepository moduleServiceRepository = new ModuleServiceRepository(moduleModel); Assertions.assertEquals(moduleServiceRepository.getModuleModel(), moduleModel); ModuleServiceRepository repository = moduleModel.getServiceRepository(); @@ -111,4 +111,4 @@ public class ModuleServiceRepositoryTest { Assertions.assertTrue(repository.getExportedServices().isEmpty()); Assertions.assertTrue(frameworkModel.getServiceRepository().allProviderModels().isEmpty()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ReflectionMethodDescriptorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ReflectionMethodDescriptorTest.java index 0707f84a2e..93462ada31 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ReflectionMethodDescriptorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ReflectionMethodDescriptorTest.java @@ -118,4 +118,4 @@ class ReflectionMethodDescriptorTest { throw new IllegalStateException(e); } } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ReflectionServiceDescriptorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ReflectionServiceDescriptorTest.java index 3361312e1f..8e1a54c284 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ReflectionServiceDescriptorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ReflectionServiceDescriptorTest.java @@ -96,4 +96,4 @@ class ReflectionServiceDescriptorTest { DemoService.class); Assertions.assertEquals(service2.hashCode(), service3.hashCode()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelAwareExtensionProcessorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelAwareExtensionProcessorTest.java index 20a59aba98..999d403a2e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelAwareExtensionProcessorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelAwareExtensionProcessorTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test; /** * {@link ScopeModelAwareExtensionProcessor} */ -public class ScopeModelAwareExtensionProcessorTest { +class ScopeModelAwareExtensionProcessorTest { private FrameworkModel frameworkModel; private ApplicationModel applicationModel; private ModuleModel moduleModel; @@ -44,7 +44,7 @@ public class ScopeModelAwareExtensionProcessorTest { } @Test - public void testInitialize() { + void testInitialize() { ScopeModelAwareExtensionProcessor processor1 = new ScopeModelAwareExtensionProcessor(frameworkModel); Assertions.assertEquals(processor1.getFrameworkModel(), frameworkModel); Assertions.assertEquals(processor1.getScopeModel(), frameworkModel); @@ -65,7 +65,7 @@ public class ScopeModelAwareExtensionProcessorTest { } @Test - public void testPostProcessAfterInitialization() throws Exception { + void testPostProcessAfterInitialization() throws Exception { ScopeModelAwareExtensionProcessor processor = new ScopeModelAwareExtensionProcessor(moduleModel); MockScopeModelAware mockScopeModelAware = new MockScopeModelAware(); Object object = processor.postProcessAfterInitialization(mockScopeModelAware, mockScopeModelAware.getClass().getName()); @@ -76,4 +76,4 @@ public class ScopeModelAwareExtensionProcessorTest { Assertions.assertEquals(mockScopeModelAware.getApplicationModel(), applicationModel); Assertions.assertEquals(mockScopeModelAware.getModuleModel(), moduleModel); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelTest.java index 59c1cbc011..e17f9319e6 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelTest.java @@ -26,10 +26,10 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.stream.Collectors; -public class ScopeModelTest { +class ScopeModelTest { @Test - public void testCreateOnDestroy() throws InterruptedException { + void testCreateOnDestroy() throws InterruptedException { FrameworkModel.destroyAll(); FrameworkModel frameworkModel = new FrameworkModel(); @@ -109,4 +109,4 @@ public class ScopeModelTest { List remainFrameworks = FrameworkModel.getAllInstances().stream().map(m -> m.getDesc()).collect(Collectors.toList()); Assertions.assertEquals(0, FrameworkModel.getAllInstances().size(), "FrameworkModel is not completely destroyed: " + remainFrameworks); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelUtilTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelUtilTest.java index 8ef46dfe97..74e912ffdf 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelUtilTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ScopeModelUtilTest.java @@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test; /** * {@link ScopeModelUtil} */ -public class ScopeModelUtilTest { +class ScopeModelUtilTest { private FrameworkModel frameworkModel; private ApplicationModel applicationModel; private ModuleModel moduleModel; @@ -46,7 +46,7 @@ public class ScopeModelUtilTest { } @Test - public void test() { + void test() { Assertions.assertEquals(ScopeModelUtil.getFrameworkModel(null), FrameworkModel.defaultModel()); Assertions.assertEquals(ScopeModelUtil.getFrameworkModel(frameworkModel), frameworkModel); @@ -111,5 +111,4 @@ public class ScopeModelUtilTest { } } -} - +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ServiceRepositoryTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ServiceRepositoryTest.java index a5dda91d7e..06787f726c 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ServiceRepositoryTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/model/ServiceRepositoryTest.java @@ -32,7 +32,7 @@ import java.util.Set; /** * {@link ServiceRepository} */ -public class ServiceRepositoryTest { +class ServiceRepositoryTest { private FrameworkModel frameworkModel; private ApplicationModel applicationModel; private ModuleModel moduleModel; @@ -50,7 +50,7 @@ public class ServiceRepositoryTest { } @Test - public void test() { + void test() { // verify BuiltinService Set builtinServices = applicationModel.getExtensionLoader(BuiltinServiceDetector.class).getSupportedExtensionInstances(); @@ -88,4 +88,4 @@ public class ServiceRepositoryTest { } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/service/GenericExceptionTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/service/GenericExceptionTest.java index edbbfc57e9..faee7712d2 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/service/GenericExceptionTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/service/GenericExceptionTest.java @@ -18,12 +18,13 @@ package org.apache.dubbo.rpc.service; import org.apache.dubbo.common.utils.JsonUtils; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.io.IOException; -public class GenericExceptionTest { +class GenericExceptionTest { @Test void jsonSupport() throws IOException { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/service/ServiceDescriptorInternalCacheTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/service/ServiceDescriptorInternalCacheTest.java index f2e2f01f25..025122368f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/service/ServiceDescriptorInternalCacheTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/service/ServiceDescriptorInternalCacheTest.java @@ -35,4 +35,4 @@ class ServiceDescriptorInternalCacheTest { Assertions.assertEquals(EchoService.class, ServiceDescriptorInternalCache.echoService().getServiceInterfaceClass()); } -} +} \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/rpc/support/ProtocolUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/rpc/support/ProtocolUtilsTest.java index 9ead55b778..d0cc3ae95c 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/rpc/support/ProtocolUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/rpc/support/ProtocolUtilsTest.java @@ -19,10 +19,10 @@ package org.apache.dubbo.rpc.support; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ProtocolUtilsTest { +class ProtocolUtilsTest { @Test - public void testGetServiceKey() { + void testGetServiceKey() { final String serviceName = "com.abc.demoService"; final int port = 1001; @@ -72,4 +72,4 @@ public class ProtocolUtilsTest { return buf.toString(); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractConfigTest.java index b15ec1d850..434c0689fc 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractConfigTest.java @@ -49,7 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -public class AbstractConfigTest { +class AbstractConfigTest { @BeforeEach public void beforeEach() { @@ -99,7 +99,7 @@ public class AbstractConfigTest { } @Test - public void testAppendProperties2() throws Exception { + void testAppendProperties2() throws Exception { try { System.setProperty("dubbo.properties.two.i", "2"); PropertiesConfig config = new PropertiesConfig("two"); @@ -111,7 +111,7 @@ public class AbstractConfigTest { } @Test - public void testAppendProperties3() throws Exception { + void testAppendProperties3() throws Exception { try { Properties p = new Properties(); p.put("dubbo.properties.str", "dubbo"); @@ -126,7 +126,7 @@ public class AbstractConfigTest { }*/ @Test - public void testValidateProtocolConfig() { + void testValidateProtocolConfig() { ProtocolConfig protocolConfig = new ProtocolConfig(); protocolConfig.setCodec("exchange"); protocolConfig.setName("test"); @@ -135,7 +135,7 @@ public class AbstractConfigTest { } @Test - public void testAppendParameters1() throws Exception { + void testAppendParameters1() throws Exception { Map parameters = new HashMap(); parameters.put("num", "ONE"); AbstractConfig.appendParameters(parameters, new ParameterConfig(1, "hello/world", 30, "password"), "prefix"); @@ -148,7 +148,7 @@ public class AbstractConfigTest { } @Test - public void testAppendParameters2() throws Exception { + void testAppendParameters2() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> { Map parameters = new HashMap(); AbstractConfig.appendParameters(parameters, new ParameterConfig()); @@ -156,14 +156,14 @@ public class AbstractConfigTest { } @Test - public void testAppendParameters3() throws Exception { + void testAppendParameters3() throws Exception { Map parameters = new HashMap(); AbstractConfig.appendParameters(parameters, null); assertTrue(parameters.isEmpty()); } @Test - public void testAppendParameters4() throws Exception { + void testAppendParameters4() throws Exception { Map parameters = new HashMap(); AbstractConfig.appendParameters(parameters, new ParameterConfig(1, "hello/world", 30, "password")); Assertions.assertEquals("one", parameters.get("key.1")); @@ -174,7 +174,7 @@ public class AbstractConfigTest { } @Test - public void testAppendAttributes1() throws Exception { + void testAppendAttributes1() throws Exception { ParameterConfig config = new ParameterConfig(1, "hello/world", 30, "password","BEIJING"); Map parameters = new HashMap<>(); AbstractConfig.appendParameters(parameters, config); @@ -195,24 +195,24 @@ public class AbstractConfigTest { } @Test - public void checkExtension() throws Exception { + void checkExtension() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> ConfigValidationUtils.checkExtension(ApplicationModel.defaultModel(), Greeting.class, "hello", "world")); } @Test - public void checkMultiExtension1() throws Exception { + void checkMultiExtension1() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> ConfigValidationUtils.checkMultiExtension(ApplicationModel.defaultModel(), Greeting.class, "hello", "default,world")); } @Test - public void checkMultiExtension2() throws Exception { + void checkMultiExtension2() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> ConfigValidationUtils.checkMultiExtension(ApplicationModel.defaultModel(), Greeting.class, "hello", "default,-world")); } @Test - public void checkLength() throws Exception { + void checkLength() throws Exception { Assertions.assertDoesNotThrow(() -> { StringBuilder builder = new StringBuilder(); for (int i = 0; i <= 200; i++) { @@ -223,7 +223,7 @@ public class AbstractConfigTest { } @Test - public void checkPathLength() throws Exception { + void checkPathLength() throws Exception { Assertions.assertDoesNotThrow(() -> { StringBuilder builder = new StringBuilder(); for (int i = 0; i <= 200; i++) { @@ -234,12 +234,12 @@ public class AbstractConfigTest { } @Test - public void checkName() throws Exception { + void checkName() throws Exception { Assertions.assertDoesNotThrow(() -> ConfigValidationUtils.checkName("hello", "world%")); } @Test - public void checkNameHasSymbol() throws Exception { + void checkNameHasSymbol() throws Exception { try { ConfigValidationUtils.checkNameHasSymbol("hello", ":*,/ -0123\tabcdABCD"); ConfigValidationUtils.checkNameHasSymbol("mock", "force:return world"); @@ -249,7 +249,7 @@ public class AbstractConfigTest { } @Test - public void checkKey() throws Exception { + void checkKey() throws Exception { try { ConfigValidationUtils.checkKey("hello", "*,-0123abcdABCD"); } catch (Exception e) { @@ -258,7 +258,7 @@ public class AbstractConfigTest { } @Test - public void checkMultiName() throws Exception { + void checkMultiName() throws Exception { try { ConfigValidationUtils.checkMultiName("hello", ",-._0123abcdABCD"); } catch (Exception e) { @@ -267,7 +267,7 @@ public class AbstractConfigTest { } @Test - public void checkPathName() throws Exception { + void checkPathName() throws Exception { try { ConfigValidationUtils.checkPathName("hello", "/-$._0123abcdABCD"); } catch (Exception e) { @@ -276,7 +276,7 @@ public class AbstractConfigTest { } @Test - public void checkMethodName() throws Exception { + void checkMethodName() throws Exception { try { ConfigValidationUtils.checkMethodName("hello", "abcdABCD0123abcd"); } catch (Exception e) { @@ -292,7 +292,7 @@ public class AbstractConfigTest { } @Test - public void checkParameterName() throws Exception { + void checkParameterName() throws Exception { Map parameters = Collections.singletonMap("hello", ":*,/-._0123abcdABCD"); try { ConfigValidationUtils.checkParameterName(parameters); @@ -319,7 +319,7 @@ public class AbstractConfigTest { } @Test - public void testRefreshAll() { + void testRefreshAll() { try { OverrideConfig overrideConfig = new OverrideConfig(); overrideConfig.setAddress("override-config://127.0.0.1:2181"); @@ -358,7 +358,7 @@ public class AbstractConfigTest { } @Test - public void testRefreshSystem() { + void testRefreshSystem() { try { OverrideConfig overrideConfig = new OverrideConfig(); overrideConfig.setAddress("override-config://127.0.0.1:2181"); @@ -382,7 +382,7 @@ public class AbstractConfigTest { } @Test - public void testRefreshProperties() throws Exception { + void testRefreshProperties() throws Exception { try { ApplicationModel.defaultModel().getModelEnvironment().setExternalConfigMap(new HashMap<>()); OverrideConfig overrideConfig = new OverrideConfig(); @@ -407,7 +407,7 @@ public class AbstractConfigTest { } @Test - public void testRefreshExternal() { + void testRefreshExternal() { try { OverrideConfig overrideConfig = new OverrideConfig(); overrideConfig.setAddress("override-config://127.0.0.1:2181"); @@ -442,7 +442,7 @@ public class AbstractConfigTest { } @Test - public void testRefreshById() { + void testRefreshById() { try { OverrideConfig overrideConfig = new OverrideConfig(); overrideConfig.setId("override-id"); @@ -474,7 +474,7 @@ public class AbstractConfigTest { } @Test - public void testRefreshParameters() { + void testRefreshParameters() { try { Map parameters = new HashMap<>(); parameters.put("key1", "value1"); @@ -507,7 +507,7 @@ public class AbstractConfigTest { } @Test - public void testRefreshParametersWithAttribute() { + void testRefreshParametersWithAttribute() { try { OverrideConfig overrideConfig = new OverrideConfig(); SysProps.setProperty("dubbo.override.parameters.key00", "value00"); @@ -519,7 +519,7 @@ public class AbstractConfigTest { } @Test - public void testRefreshParametersWithOverrideConfigMode() { + void testRefreshParametersWithOverrideConfigMode() { FrameworkModel frameworkModel = new FrameworkModel(); try { // test OVERRIDE_ALL configMode @@ -578,7 +578,7 @@ public class AbstractConfigTest { } @Test - public void testOnlyPrefixedKeyTakeEffect() { + void testOnlyPrefixedKeyTakeEffect() { try { OverrideConfig overrideConfig = new OverrideConfig(); overrideConfig.setNotConflictKey("value-from-config"); @@ -600,7 +600,7 @@ public class AbstractConfigTest { } @Test - public void tetMetaData() { + void tetMetaData() { OverrideConfig overrideConfig = new OverrideConfig(); overrideConfig.setId("override-id"); overrideConfig.setAddress("override-config://127.0.0.1:2181"); @@ -625,7 +625,7 @@ public class AbstractConfigTest { } @Test - public void testEquals() { + void testEquals() { ApplicationConfig application1 = new ApplicationConfig(); ApplicationConfig application2 = new ApplicationConfig(); application1.setName("app1"); @@ -994,7 +994,7 @@ public class AbstractConfigTest { } @Test - public void testMetaData() throws Exception { + void testMetaData() throws Exception { // Expect empty metadata for new instance // Check and set default value of field in checkDefault() method @@ -1013,7 +1013,7 @@ public class AbstractConfigTest { } @Test - public void testRefreshNested() { + void testRefreshNested() { try { OuterConfig outerConfig = new OuterConfig(); diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractMethodConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractMethodConfigTest.java index 2c75a185b6..c13197da14 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractMethodConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractMethodConfigTest.java @@ -30,7 +30,7 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.isEmptyOrNullString; import static org.hamcrest.Matchers.sameInstance; -public class AbstractMethodConfigTest { +class AbstractMethodConfigTest { @AfterAll public static void afterAll() { @@ -38,56 +38,56 @@ public class AbstractMethodConfigTest { } @Test - public void testTimeout() throws Exception { + void testTimeout() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setTimeout(10); assertThat(methodConfig.getTimeout(), equalTo(10)); } @Test - public void testForks() throws Exception { + void testForks() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setForks(10); assertThat(methodConfig.getForks(), equalTo(10)); } @Test - public void testRetries() throws Exception { + void testRetries() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setRetries(3); assertThat(methodConfig.getRetries(), equalTo(3)); } @Test - public void testLoadbalance() throws Exception { + void testLoadbalance() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setLoadbalance("mockloadbalance"); assertThat(methodConfig.getLoadbalance(), equalTo("mockloadbalance")); } @Test - public void testAsync() throws Exception { + void testAsync() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setAsync(true); assertThat(methodConfig.isAsync(), is(true)); } @Test - public void testActives() throws Exception { + void testActives() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setActives(10); assertThat(methodConfig.getActives(), equalTo(10)); } @Test - public void testSent() throws Exception { + void testSent() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setSent(true); assertThat(methodConfig.getSent(), is(true)); } @Test - public void testMock() throws Exception { + void testMock() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setMock((Boolean) null); assertThat(methodConfig.getMock(), isEmptyOrNullString()); @@ -100,28 +100,28 @@ public class AbstractMethodConfigTest { } @Test - public void testMerger() throws Exception { + void testMerger() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setMerger("merger"); assertThat(methodConfig.getMerger(), equalTo("merger")); } @Test - public void testCache() throws Exception { + void testCache() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setCache("cache"); assertThat(methodConfig.getCache(), equalTo("cache")); } @Test - public void testValidation() throws Exception { + void testValidation() throws Exception { MethodConfig methodConfig = new MethodConfig(); methodConfig.setValidation("validation"); assertThat(methodConfig.getValidation(), equalTo("validation")); } @Test - public void testParameters() throws Exception { + void testParameters() throws Exception { MethodConfig methodConfig = new MethodConfig(); Map parameters = new HashMap(); parameters.put("key", "value"); @@ -132,4 +132,4 @@ public class AbstractMethodConfigTest { private static class MethodConfig extends AbstractMethodConfig { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractReferenceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractReferenceConfigTest.java index 7728c99187..a00960c715 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractReferenceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractReferenceConfigTest.java @@ -48,7 +48,7 @@ import static org.hamcrest.Matchers.is; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class AbstractReferenceConfigTest { +class AbstractReferenceConfigTest { @AfterAll public static void afterAll() throws Exception { @@ -56,21 +56,21 @@ public class AbstractReferenceConfigTest { } @Test - public void testCheck() throws Exception { + void testCheck() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setCheck(true); assertThat(referenceConfig.isCheck(), is(true)); } @Test - public void testInit() throws Exception { + void testInit() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setInit(true); assertThat(referenceConfig.isInit(), is(true)); } @Test - public void testGeneric() throws Exception { + void testGeneric() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setGeneric(true); assertThat(referenceConfig.isGeneric(), is(true)); @@ -81,14 +81,14 @@ public class AbstractReferenceConfigTest { } @Test - public void testInjvm() throws Exception { + void testInjvm() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setInjvm(true); assertThat(referenceConfig.isInjvm(), is(true)); } @Test - public void testFilter() throws Exception { + void testFilter() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setFilter("mockfilter"); assertThat(referenceConfig.getFilter(), equalTo("mockfilter")); @@ -99,7 +99,7 @@ public class AbstractReferenceConfigTest { } @Test - public void testRouter() throws Exception { + void testRouter() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setRouter("condition"); assertThat(referenceConfig.getRouter(), equalTo("condition")); @@ -119,7 +119,7 @@ public class AbstractReferenceConfigTest { } @Test - public void testListener() throws Exception { + void testListener() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setListener("mockinvokerlistener"); assertThat(referenceConfig.getListener(), equalTo("mockinvokerlistener")); @@ -130,14 +130,14 @@ public class AbstractReferenceConfigTest { } @Test - public void testLazy() throws Exception { + void testLazy() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setLazy(true); assertThat(referenceConfig.getLazy(), is(true)); } @Test - public void testOnconnect() throws Exception { + void testOnconnect() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setOnconnect("onConnect"); assertThat(referenceConfig.getOnconnect(), equalTo("onConnect")); @@ -145,7 +145,7 @@ public class AbstractReferenceConfigTest { } @Test - public void testOndisconnect() throws Exception { + void testOndisconnect() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setOndisconnect("onDisconnect"); assertThat(referenceConfig.getOndisconnect(), equalTo("onDisconnect")); @@ -153,7 +153,7 @@ public class AbstractReferenceConfigTest { } @Test - public void testStubevent() throws Exception { + void testStubevent() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setOnconnect("onConnect"); Map parameters = new HashMap(); @@ -162,7 +162,7 @@ public class AbstractReferenceConfigTest { } @Test - public void testReconnect() throws Exception { + void testReconnect() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setReconnect("reconnect"); Map parameters = new HashMap(); @@ -172,7 +172,7 @@ public class AbstractReferenceConfigTest { } @Test - public void testSticky() throws Exception { + void testSticky() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setSticky(true); Map parameters = new HashMap(); @@ -182,21 +182,21 @@ public class AbstractReferenceConfigTest { } @Test - public void testVersion() throws Exception { + void testVersion() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setVersion("version"); assertThat(referenceConfig.getVersion(), equalTo("version")); } @Test - public void testGroup() throws Exception { + void testGroup() throws Exception { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setGroup("group"); assertThat(referenceConfig.getGroup(), equalTo("group")); } @Test - public void testGenericOverride() { + void testGenericOverride() { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setGeneric("false"); referenceConfig.refresh(); @@ -217,4 +217,4 @@ public class AbstractReferenceConfigTest { private static class ReferenceConfig extends AbstractReferenceConfig { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractServiceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractServiceConfigTest.java index dd27a14ca6..d0c630ee41 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractServiceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractServiceConfigTest.java @@ -35,44 +35,44 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; -public class AbstractServiceConfigTest { +class AbstractServiceConfigTest { @Test - public void testVersion() throws Exception { + void testVersion() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setVersion("version"); assertThat(serviceConfig.getVersion(), equalTo("version")); } @Test - public void testGroup() throws Exception { + void testGroup() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setGroup("group"); assertThat(serviceConfig.getGroup(), equalTo("group")); } @Test - public void testDelay() throws Exception { + void testDelay() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setDelay(1000); assertThat(serviceConfig.getDelay(), equalTo(1000)); } @Test - public void testExport() throws Exception { + void testExport() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setExport(true); assertThat(serviceConfig.getExport(), is(true)); } @Test - public void testWeight() throws Exception { + void testWeight() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setWeight(500); assertThat(serviceConfig.getWeight(), equalTo(500)); } @Test - public void testDocument() throws Exception { + void testDocument() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setDocument("http://dubbo.apache.org"); assertThat(serviceConfig.getDocument(), equalTo("http://dubbo.apache.org")); @@ -82,7 +82,7 @@ public class AbstractServiceConfigTest { } @Test - public void testToken() throws Exception { + void testToken() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setToken("token"); assertThat(serviceConfig.getToken(), equalTo("token")); @@ -93,21 +93,21 @@ public class AbstractServiceConfigTest { } @Test - public void testDeprecated() throws Exception { + void testDeprecated() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setDeprecated(true); assertThat(serviceConfig.isDeprecated(), is(true)); } @Test - public void testDynamic() throws Exception { + void testDynamic() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setDynamic(true); assertThat(serviceConfig.isDynamic(), is(true)); } @Test - public void testProtocol() throws Exception { + void testProtocol() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); assertThat(serviceConfig.getProtocol(), nullValue()); serviceConfig.setProtocol(new ProtocolConfig()); @@ -117,7 +117,7 @@ public class AbstractServiceConfigTest { } @Test - public void testAccesslog() throws Exception { + void testAccesslog() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setAccesslog("access.log"); assertThat(serviceConfig.getAccesslog(), equalTo("access.log")); @@ -128,14 +128,14 @@ public class AbstractServiceConfigTest { } @Test - public void testExecutes() throws Exception { + void testExecutes() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setExecutes(10); assertThat(serviceConfig.getExecutes(), equalTo(10)); } @Test - public void testFilter() throws Exception { + void testFilter() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setFilter("mockfilter"); assertThat(serviceConfig.getFilter(), equalTo("mockfilter")); @@ -146,7 +146,7 @@ public class AbstractServiceConfigTest { } @Test - public void testListener() throws Exception { + void testListener() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setListener("mockexporterlistener"); assertThat(serviceConfig.getListener(), equalTo("mockexporterlistener")); @@ -157,21 +157,21 @@ public class AbstractServiceConfigTest { } @Test - public void testRegister() throws Exception { + void testRegister() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setRegister(true); assertThat(serviceConfig.isRegister(), is(true)); } @Test - public void testWarmup() throws Exception { + void testWarmup() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setWarmup(100); assertThat(serviceConfig.getWarmup(), equalTo(100)); } @Test - public void testSerialization() throws Exception { + void testSerialization() throws Exception { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.setSerialization("serialization"); assertThat(serviceConfig.getSerialization(), equalTo("serialization")); @@ -188,4 +188,4 @@ public class AbstractServiceConfigTest { private static class ServiceConfig extends AbstractServiceConfig { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java index 7eb8c74cce..5fc3dbe40a 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java @@ -40,7 +40,7 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.sameInstance; import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -public class ApplicationConfigTest { +class ApplicationConfigTest { @BeforeEach public void beforeEach() { @@ -53,7 +53,7 @@ public class ApplicationConfigTest { } @Test - public void testName() throws Exception { + void testName() throws Exception { ApplicationConfig application = new ApplicationConfig(); application.setName("app"); assertThat(application.getName(), equalTo("app")); @@ -69,7 +69,7 @@ public class ApplicationConfigTest { } @Test - public void testVersion() throws Exception { + void testVersion() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setVersion("1.0.0"); assertThat(application.getVersion(), equalTo("1.0.0")); @@ -79,28 +79,28 @@ public class ApplicationConfigTest { } @Test - public void testOwner() throws Exception { + void testOwner() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setOwner("owner"); assertThat(application.getOwner(), equalTo("owner")); } @Test - public void testOrganization() throws Exception { + void testOrganization() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setOrganization("org"); assertThat(application.getOrganization(), equalTo("org")); } @Test - public void testArchitecture() throws Exception { + void testArchitecture() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setArchitecture("arch"); assertThat(application.getArchitecture(), equalTo("arch")); } @Test - public void testEnvironment1() throws Exception { + void testEnvironment1() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setEnvironment("develop"); assertThat(application.getEnvironment(), equalTo("develop")); @@ -111,7 +111,7 @@ public class ApplicationConfigTest { } @Test - public void testEnvironment2() throws Exception { + void testEnvironment2() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> { ApplicationConfig application = new ApplicationConfig("app"); application.setEnvironment("illegal-env"); @@ -119,7 +119,7 @@ public class ApplicationConfigTest { } @Test - public void testRegistry() throws Exception { + void testRegistry() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); RegistryConfig registry = new RegistryConfig(); application.setRegistry(registry); @@ -130,7 +130,7 @@ public class ApplicationConfigTest { } @Test - public void testMonitor() throws Exception { + void testMonitor() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setMonitor(new MonitorConfig("monitor-addr")); assertThat(application.getMonitor().getAddress(), equalTo("monitor-addr")); @@ -139,21 +139,21 @@ public class ApplicationConfigTest { } @Test - public void testLogger() throws Exception { + void testLogger() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setLogger("log4j"); assertThat(application.getLogger(), equalTo("log4j")); } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setDefault(true); assertThat(application.isDefault(), is(true)); } @Test - public void testDumpDirectory() throws Exception { + void testDumpDirectory() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setDumpDirectory("/dump"); assertThat(application.getDumpDirectory(), equalTo("/dump")); @@ -163,7 +163,7 @@ public class ApplicationConfigTest { } @Test - public void testQosEnable() throws Exception { + void testQosEnable() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setQosEnable(true); assertThat(application.getQosEnable(), is(true)); @@ -173,14 +173,14 @@ public class ApplicationConfigTest { } @Test - public void testQosPort() throws Exception { + void testQosPort() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setQosPort(8080); assertThat(application.getQosPort(), equalTo(8080)); } @Test - public void testQosAcceptForeignIp() throws Exception { + void testQosAcceptForeignIp() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setQosAcceptForeignIp(true); assertThat(application.getQosAcceptForeignIp(), is(true)); @@ -190,7 +190,7 @@ public class ApplicationConfigTest { } @Test - public void testParameters() throws Exception { + void testParameters() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setQosAcceptForeignIp(true); Map parameters = new HashMap(); @@ -201,7 +201,7 @@ public class ApplicationConfigTest { } @Test - public void testAppendEnvironmentProperties() { + void testAppendEnvironmentProperties() { ApplicationConfig application = new ApplicationConfig("app"); SysProps.setProperty("dubbo.labels", "tag1=value1;tag2=value2 ; tag3 = value3"); application.refresh(); @@ -229,14 +229,14 @@ public class ApplicationConfigTest { } @Test - public void testMetaData() { + void testMetaData() { ApplicationConfig config = new ApplicationConfig(); Map metaData = config.getMetaData(); Assertions.assertEquals(0, metaData.size(), "Expect empty metadata but found: "+metaData); } @Test - public void testOverrideEmptyConfig() { + void testOverrideEmptyConfig() { String owner = "tom1"; SysProps.setProperty("dubbo.application.name", "demo-app"); SysProps.setProperty("dubbo.application.owner", owner); @@ -255,7 +255,7 @@ public class ApplicationConfigTest { } @Test - public void testOverrideConfigById() { + void testOverrideConfigById() { String owner = "tom2"; SysProps.setProperty("dubbo.applications.demo-app.owner", owner); SysProps.setProperty("dubbo.applications.demo-app.version", "1.2.3"); @@ -277,7 +277,7 @@ public class ApplicationConfigTest { } @Test - public void testOverrideConfigByName() { + void testOverrideConfigByName() { String owner = "tom3"; SysProps.setProperty("dubbo.applications.demo-app.owner", owner); SysProps.setProperty("dubbo.applications.demo-app.version", "1.2.3"); @@ -296,7 +296,7 @@ public class ApplicationConfigTest { } @Test - public void testLoadConfig() { + void testLoadConfig() { String owner = "tom4"; SysProps.setProperty("dubbo.applications.demo-app.owner", owner); SysProps.setProperty("dubbo.applications.demo-app.version", "1.2.3"); @@ -315,7 +315,7 @@ public class ApplicationConfigTest { } @Test - public void testOverrideConfigConvertCase() { + void testOverrideConfigConvertCase() { SysProps.setProperty("dubbo.application.NAME", "demo-app"); SysProps.setProperty("dubbo.application.qos-Enable", "false"); SysProps.setProperty("dubbo.application.qos_host", "127.0.0.1"); @@ -333,4 +333,4 @@ public class ApplicationConfigTest { DubboBootstrap.getInstance().destroy(); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java index 0fff22d94e..a966a3d794 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java @@ -27,30 +27,30 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.is; -public class ArgumentConfigTest { +class ArgumentConfigTest { @Test - public void testIndex() throws Exception { + void testIndex() throws Exception { ArgumentConfig argument = new ArgumentConfig(); argument.setIndex(1); assertThat(argument.getIndex(), is(1)); } @Test - public void testType() throws Exception { + void testType() throws Exception { ArgumentConfig argument = new ArgumentConfig(); argument.setType("int"); assertThat(argument.getType(), equalTo("int")); } @Test - public void testCallback() throws Exception { + void testCallback() throws Exception { ArgumentConfig argument = new ArgumentConfig(); argument.setCallback(true); assertThat(argument.isCallback(), is(true)); } @Test - public void testArguments() throws Exception { + void testArguments() throws Exception { ArgumentConfig argument = new ArgumentConfig(); argument.setIndex(1); argument.setType("int"); @@ -60,4 +60,4 @@ public class ArgumentConfigTest { assertThat(parameters, hasEntry("callback", "true")); assertThat(parameters.size(), is(1)); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConfigCenterConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConfigCenterConfigTest.java index 6c66b19448..961feee93b 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConfigCenterConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConfigCenterConfigTest.java @@ -35,7 +35,7 @@ import java.util.Map; import static org.apache.dubbo.remoting.Constants.CLIENT_KEY; -public class ConfigCenterConfigTest { +class ConfigCenterConfigTest { @BeforeEach public void setUp() { @@ -48,7 +48,7 @@ public class ConfigCenterConfigTest { } @Test - public void testPrefix() { + void testPrefix() { ConfigCenterConfig config = new ConfigCenterConfig(); Assertions.assertEquals(Arrays.asList("dubbo.config-center"), config.getPrefixes()); @@ -58,7 +58,7 @@ public class ConfigCenterConfigTest { } @Test - public void testToUrl() { + void testToUrl() { ConfigCenterConfig config = new ConfigCenterConfig(); config.setNamespace("namespace"); config.setGroup("group"); @@ -74,7 +74,7 @@ public class ConfigCenterConfigTest { } @Test - public void testOverrideConfig() { + void testOverrideConfig() { String zkAddr = ZookeeperRegistryCenterConfig.getConnectionAddress(); // sysprops has no id @@ -105,7 +105,7 @@ public class ConfigCenterConfigTest { } @Test - public void testOverrideConfig2() { + void testOverrideConfig2() { String zkAddr = "nacos://127.0.0.1:8848"; // sysprops has no id @@ -131,7 +131,7 @@ public class ConfigCenterConfigTest { } @Test - public void testOverrideConfigBySystemProps() { + void testOverrideConfigBySystemProps() { //Config instance has Id, but sysprops without id SysProps.setProperty("dubbo.config-center.check", "false"); @@ -156,7 +156,7 @@ public class ConfigCenterConfigTest { } @Test - public void testOverrideConfigByDubboProps() { + void testOverrideConfigByDubboProps() { ApplicationModel.defaultModel().getDefaultModule(); // Config instance has id, dubbo props has no id @@ -185,7 +185,7 @@ public class ConfigCenterConfigTest { } @Test - public void testOverrideConfigBySystemPropsWithId() { + void testOverrideConfigBySystemPropsWithId() { // Both config instance and sysprops have id SysProps.setProperty("dubbo.config-centers.configcenterA.check", "false"); @@ -211,7 +211,7 @@ public class ConfigCenterConfigTest { } @Test - public void testOverrideConfigByDubboPropsWithId() { + void testOverrideConfigByDubboPropsWithId() { ApplicationModel.defaultModel().getDefaultModule(); // Config instance has id, dubbo props has id @@ -241,14 +241,14 @@ public class ConfigCenterConfigTest { } @Test - public void testMetaData() { + void testMetaData() { ConfigCenterConfig configCenter = new ConfigCenterConfig(); Map metaData = configCenter.getMetaData(); Assertions.assertEquals(0, metaData.size(), "Expect empty metadata but found: "+metaData); } @Test - public void testParameters() { + void testParameters() { ConfigCenterConfig cc = new ConfigCenterConfig(); cc.setParameters(new LinkedHashMap<>()); cc.getParameters().put(CLIENT_KEY, null); @@ -265,7 +265,7 @@ public class ConfigCenterConfigTest { } @Test - public void testAttributes() { + void testAttributes() { ConfigCenterConfig cc = new ConfigCenterConfig(); cc.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress()); Map attributes = new LinkedHashMap<>(); @@ -280,7 +280,7 @@ public class ConfigCenterConfigTest { } @Test - public void testSetAddress() { + void testSetAddress() { String address = ZookeeperRegistryCenterConfig.getConnectionAddress(); ConfigCenterConfig cc = new ConfigCenterConfig(); cc.setUsername("user123"); // set username first @@ -294,4 +294,4 @@ public class ConfigCenterConfigTest { Assertions.assertEquals("pass123", cc.getPassword()); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConfigScopeModelInitializerTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConfigScopeModelInitializerTest.java index f80f546178..41dcd420ca 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConfigScopeModelInitializerTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConfigScopeModelInitializerTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class ConfigScopeModelInitializerTest { +class ConfigScopeModelInitializerTest { private FrameworkModel frameworkModel; private ApplicationModel applicationModel; private ModuleModel moduleModel; @@ -43,8 +43,8 @@ public class ConfigScopeModelInitializerTest { } @Test - public void test(){ + void test(){ Assertions.assertNotNull(applicationModel.getDeployer()); Assertions.assertNotNull(moduleModel.getDeployer()); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java index 6bc617c975..7f868651cf 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java @@ -33,7 +33,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; -public class ConsumerConfigTest { +class ConsumerConfigTest { @BeforeEach public void setUp() { @@ -46,7 +46,7 @@ public class ConsumerConfigTest { } @Test - public void testTimeout() throws Exception { + void testTimeout() throws Exception { System.clearProperty("sun.rmi.transport.tcp.responseTimeout"); ConsumerConfig consumer = new ConsumerConfig(); consumer.setTimeout(10); @@ -55,49 +55,49 @@ public class ConsumerConfigTest { } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { ConsumerConfig consumer = new ConsumerConfig(); consumer.setDefault(true); assertThat(consumer.isDefault(), is(true)); } @Test - public void testClient() throws Exception { + void testClient() throws Exception { ConsumerConfig consumer = new ConsumerConfig(); consumer.setClient("client"); assertThat(consumer.getClient(), equalTo("client")); } @Test - public void testThreadpool() throws Exception { + void testThreadpool() throws Exception { ConsumerConfig consumer = new ConsumerConfig(); consumer.setThreadpool("fixed"); assertThat(consumer.getThreadpool(), equalTo("fixed")); } @Test - public void testCorethreads() throws Exception { + void testCorethreads() throws Exception { ConsumerConfig consumer = new ConsumerConfig(); consumer.setCorethreads(10); assertThat(consumer.getCorethreads(), equalTo(10)); } @Test - public void testThreads() throws Exception { + void testThreads() throws Exception { ConsumerConfig consumer = new ConsumerConfig(); consumer.setThreads(20); assertThat(consumer.getThreads(), equalTo(20)); } @Test - public void testQueues() throws Exception { + void testQueues() throws Exception { ConsumerConfig consumer = new ConsumerConfig(); consumer.setQueues(5); assertThat(consumer.getQueues(), equalTo(5)); } @Test - public void testOverrideConfigSingle() { + void testOverrideConfigSingle() { SysProps.setProperty("dubbo.consumer.check", "false"); SysProps.setProperty("dubbo.consumer.group", "demo"); SysProps.setProperty("dubbo.consumer.threads", "10"); @@ -124,7 +124,7 @@ public class ConsumerConfigTest { } @Test - public void testOverrideConfigByPluralityId() { + void testOverrideConfigByPluralityId() { SysProps.setProperty("dubbo.consumer.group", "demoA"); //ignore SysProps.setProperty("dubbo.consumers.consumerA.check", "false"); SysProps.setProperty("dubbo.consumers.consumerA.group", "demoB"); @@ -152,7 +152,7 @@ public class ConsumerConfigTest { } @Test - public void testOverrideConfigBySingularId() { + void testOverrideConfigBySingularId() { // override success SysProps.setProperty("dubbo.consumer.group", "demoA"); SysProps.setProperty("dubbo.consumer.threads", "15"); @@ -183,7 +183,7 @@ public class ConsumerConfigTest { } @Test - public void testOverrideConfigByDubboProps() { + void testOverrideConfigByDubboProps() { ApplicationModel.defaultModel().getDefaultModule(); ApplicationModel.defaultModel().getModelEnvironment().getPropertiesConfiguration().setProperty("dubbo.consumers.consumerA.check", "false"); ApplicationModel.defaultModel().getModelEnvironment().getPropertiesConfiguration().setProperty("dubbo.consumers.consumerA.group", "demo"); @@ -212,7 +212,7 @@ public class ConsumerConfigTest { } @Test - public void testReferenceAndConsumerConfigOverlay() { + void testReferenceAndConsumerConfigOverlay() { SysProps.setProperty("dubbo.consumer.group", "demo"); SysProps.setProperty("dubbo.consumer.threads", "12"); SysProps.setProperty("dubbo.consumer.timeout", "1234"); @@ -238,9 +238,9 @@ public class ConsumerConfigTest { } @Test - public void testMetaData() { + void testMetaData() { ConsumerConfig consumerConfig = new ConsumerConfig(); Map metaData = consumerConfig.getMetaData(); Assertions.assertEquals(0, metaData.size(), "Expect empty metadata but found: "+metaData); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetadataReportConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetadataReportConfigTest.java index 18ee25f9e6..62fb8723f8 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetadataReportConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetadataReportConfigTest.java @@ -24,9 +24,9 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class MetadataReportConfigTest { +class MetadataReportConfigTest { @Test - public void testFile() { + void testFile() { MetadataReportConfig metadataReportConfig = new MetadataReportConfig(); metadataReportConfig.setFile("file"); assertThat(metadataReportConfig.getFile(), equalTo("file")); @@ -37,4 +37,4 @@ public class MetadataReportConfigTest { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MethodConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MethodConfigTest.java index 90926db738..7b137c5762 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MethodConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MethodConfigTest.java @@ -51,7 +51,7 @@ import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; -public class MethodConfigTest { +class MethodConfigTest { private static final String METHOD_NAME = "sayHello"; private static final int TIMEOUT = 1300; private static final int RETRIES = 4; @@ -91,7 +91,7 @@ public class MethodConfigTest { //TODO remove this test @Test - public void testStaticConstructor() throws NoSuchFieldException { + void testStaticConstructor() throws NoSuchFieldException { Method[] methods = this.getClass().getDeclaredField("testField").getAnnotation(Reference.class).methods(); List methodConfigs = MethodConfig.constructMethodConfig(methods); MethodConfig methodConfig = methodConfigs.get(0); @@ -119,7 +119,7 @@ public class MethodConfigTest { } @Test - public void testName() throws Exception { + void testName() throws Exception { MethodConfig method = new MethodConfig(); method.setName("hello"); assertThat(method.getName(), equalTo("hello")); @@ -129,42 +129,42 @@ public class MethodConfigTest { } @Test - public void testStat() throws Exception { + void testStat() throws Exception { MethodConfig method = new MethodConfig(); method.setStat(10); assertThat(method.getStat(), equalTo(10)); } @Test - public void testRetry() throws Exception { + void testRetry() throws Exception { MethodConfig method = new MethodConfig(); method.setRetry(true); assertThat(method.isRetry(), is(true)); } @Test - public void testReliable() throws Exception { + void testReliable() throws Exception { MethodConfig method = new MethodConfig(); method.setReliable(true); assertThat(method.isReliable(), is(true)); } @Test - public void testExecutes() throws Exception { + void testExecutes() throws Exception { MethodConfig method = new MethodConfig(); method.setExecutes(10); assertThat(method.getExecutes(), equalTo(10)); } @Test - public void testDeprecated() throws Exception { + void testDeprecated() throws Exception { MethodConfig method = new MethodConfig(); method.setDeprecated(true); assertThat(method.getDeprecated(), is(true)); } @Test - public void testArguments() throws Exception { + void testArguments() throws Exception { MethodConfig method = new MethodConfig(); ArgumentConfig argument = new ArgumentConfig(); method.setArguments(Collections.singletonList(argument)); @@ -173,7 +173,7 @@ public class MethodConfigTest { } @Test - public void testSticky() throws Exception { + void testSticky() throws Exception { MethodConfig method = new MethodConfig(); method.setSticky(true); assertThat(method.getSticky(), is(true)); @@ -193,7 +193,7 @@ public class MethodConfigTest { } @Test - public void testOnReturnMethod() throws Exception { + void testOnReturnMethod() throws Exception { MethodConfig method = new MethodConfig(); method.setOnreturnMethod("on-return-method"); assertThat(method.getOnreturnMethod(), equalTo("on-return-method")); @@ -219,7 +219,7 @@ public class MethodConfigTest { } @Test - public void testOnThrowMethod() throws Exception { + void testOnThrowMethod() throws Exception { MethodConfig method = new MethodConfig(); method.setOnthrowMethod("on-throw-method"); assertThat(method.getOnthrowMethod(), equalTo("on-throw-method")); @@ -245,7 +245,7 @@ public class MethodConfigTest { } @Test - public void testOnInvokeMethod() throws Exception { + void testOnInvokeMethod() throws Exception { MethodConfig method = new MethodConfig(); method.setOninvokeMethod("on-invoke-method"); assertThat(method.getOninvokeMethod(), equalTo("on-invoke-method")); @@ -258,14 +258,14 @@ public class MethodConfigTest { } @Test - public void testReturn() throws Exception { + void testReturn() throws Exception { MethodConfig method = new MethodConfig(); method.setReturn(true); assertThat(method.isReturn(), is(true)); } @Test - public void testOverrideMethodConfigOfReference() { + void testOverrideMethodConfigOfReference() { String interfaceName = DemoService.class.getName(); SysProps.setProperty("dubbo.reference."+ interfaceName +".sayName.timeout", "1234"); @@ -297,7 +297,7 @@ public class MethodConfigTest { } @Test - public void testAddMethodConfigOfReference() { + void testAddMethodConfigOfReference() { String interfaceName = DemoService.class.getName(); SysProps.setProperty("dubbo.reference."+ interfaceName +".sayName.timeout", "1234"); @@ -331,7 +331,7 @@ public class MethodConfigTest { } @Test - public void testOverrideMethodConfigOfService() { + void testOverrideMethodConfigOfService() { String interfaceName = DemoService.class.getName(); SysProps.setProperty("dubbo.service."+ interfaceName +".sayName.timeout", "1234"); @@ -367,7 +367,7 @@ public class MethodConfigTest { } @Test - public void testAddMethodConfigOfService() { + void testAddMethodConfigOfService() { String interfaceName = DemoService.class.getName(); SysProps.setProperty("dubbo.service."+ interfaceName +".sayName.timeout", "1234"); @@ -411,7 +411,7 @@ public class MethodConfigTest { } @Test - public void testVerifyMethodConfigOfService() { + void testVerifyMethodConfigOfService() { String interfaceName = DemoService.class.getName(); SysProps.setProperty("dubbo.service."+ interfaceName +".sayHello.timeout", "1234"); @@ -443,7 +443,7 @@ public class MethodConfigTest { } @Test - public void testIgnoreInvalidMethodConfigOfService() { + void testIgnoreInvalidMethodConfigOfService() { String interfaceName = DemoService.class.getName(); SysProps.setProperty("dubbo.service."+ interfaceName +".sayHello.timeout", "1234"); @@ -471,9 +471,9 @@ public class MethodConfigTest { } @Test - public void testMetaData() { + void testMetaData() { MethodConfig methodConfig = new MethodConfig(); Map metaData = methodConfig.getMetaData(); Assertions.assertEquals(0, metaData.size(), "Expect empty metadata but found: "+metaData); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetricsConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetricsConfigTest.java index ed6fd87dab..f752b7e86c 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetricsConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MetricsConfigTest.java @@ -26,10 +26,10 @@ import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMET import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class MetricsConfigTest { +class MetricsConfigTest { @Test - public void testToUrl() { + void testToUrl() { MetricsConfig metrics = new MetricsConfig(); metrics.setProtocol(PROTOCOL_PROMETHEUS); @@ -59,14 +59,14 @@ public class MetricsConfigTest { } @Test - public void testProtocol() { + void testProtocol() { MetricsConfig metrics = new MetricsConfig(); metrics.setProtocol(PROTOCOL_PROMETHEUS); assertThat(metrics.getProtocol(), equalTo(PROTOCOL_PROMETHEUS)); } @Test - public void testPrometheus() { + void testPrometheus() { MetricsConfig metrics = new MetricsConfig(); PrometheusConfig prometheus = new PrometheusConfig(); @@ -104,7 +104,7 @@ public class MetricsConfigTest { } @Test - public void testAggregation() { + void testAggregation() { MetricsConfig metrics = new MetricsConfig(); AggregationConfig aggregation = new AggregationConfig(); @@ -117,4 +117,4 @@ public class MetricsConfigTest { assertThat(metrics.getAggregation().getBucketNum(), equalTo(5)); assertThat(metrics.getAggregation().getTimeWindowSeconds(), equalTo(120)); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java index 67a1339219..6aeba1bc98 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java @@ -32,10 +32,10 @@ import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.sameInstance; -public class ModuleConfigTest { +class ModuleConfigTest { @Test - public void testName2() throws Exception { + void testName2() throws Exception { ModuleConfig module = new ModuleConfig(); module.setName("module-name"); assertThat(module.getName(), equalTo("module-name")); @@ -46,7 +46,7 @@ public class ModuleConfigTest { } @Test - public void testVersion() throws Exception { + void testVersion() throws Exception { ModuleConfig module = new ModuleConfig(); module.setName("module-name"); module.setVersion("1.0.0"); @@ -57,21 +57,21 @@ public class ModuleConfigTest { } @Test - public void testOwner() throws Exception { + void testOwner() throws Exception { ModuleConfig module = new ModuleConfig(); module.setOwner("owner"); assertThat(module.getOwner(), equalTo("owner")); } @Test - public void testOrganization() throws Exception { + void testOrganization() throws Exception { ModuleConfig module = new ModuleConfig(); module.setOrganization("org"); assertThat(module.getOrganization(), equalTo("org")); } @Test - public void testRegistry() throws Exception { + void testRegistry() throws Exception { ModuleConfig module = new ModuleConfig(); RegistryConfig registry = new RegistryConfig(); module.setRegistry(registry); @@ -79,7 +79,7 @@ public class ModuleConfigTest { } @Test - public void testRegistries() throws Exception { + void testRegistries() throws Exception { ModuleConfig module = new ModuleConfig(); RegistryConfig registry = new RegistryConfig(); module.setRegistries(Collections.singletonList(registry)); @@ -88,7 +88,7 @@ public class ModuleConfigTest { } @Test - public void testMonitor() throws Exception { + void testMonitor() throws Exception { ModuleConfig module = new ModuleConfig(); module.setMonitor("monitor-addr1"); assertThat(module.getMonitor().getAddress(), equalTo("monitor-addr1")); @@ -97,16 +97,16 @@ public class ModuleConfigTest { } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { ModuleConfig module = new ModuleConfig(); module.setDefault(true); assertThat(module.isDefault(), is(true)); } @Test - public void testMetaData() { + void testMetaData() { MonitorConfig config = new MonitorConfig(); Map metaData = config.getMetaData(); Assertions.assertEquals(0, metaData.size(), "Expect empty metadata but found: "+metaData); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MonitorConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MonitorConfigTest.java index b5779af1c5..0edf1c9b87 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MonitorConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MonitorConfigTest.java @@ -29,9 +29,9 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.is; -public class MonitorConfigTest { +class MonitorConfigTest { @Test - public void testAddress() throws Exception { + void testAddress() throws Exception { MonitorConfig monitor = new MonitorConfig(); monitor.setAddress("monitor-addr"); assertThat(monitor.getAddress(), equalTo("monitor-addr")); @@ -41,7 +41,7 @@ public class MonitorConfigTest { } @Test - public void testProtocol() throws Exception { + void testProtocol() throws Exception { MonitorConfig monitor = new MonitorConfig(); monitor.setProtocol("protocol"); assertThat(monitor.getProtocol(), equalTo("protocol")); @@ -51,7 +51,7 @@ public class MonitorConfigTest { } @Test - public void testUsername() throws Exception { + void testUsername() throws Exception { MonitorConfig monitor = new MonitorConfig(); monitor.setUsername("user"); assertThat(monitor.getUsername(), equalTo("user")); @@ -61,7 +61,7 @@ public class MonitorConfigTest { } @Test - public void testPassword() throws Exception { + void testPassword() throws Exception { MonitorConfig monitor = new MonitorConfig(); monitor.setPassword("secret"); assertThat(monitor.getPassword(), equalTo("secret")); @@ -71,21 +71,21 @@ public class MonitorConfigTest { } @Test - public void testGroup() throws Exception { + void testGroup() throws Exception { MonitorConfig monitor = new MonitorConfig(); monitor.setGroup("group"); assertThat(monitor.getGroup(), equalTo("group")); } @Test - public void testVersion() throws Exception { + void testVersion() throws Exception { MonitorConfig monitor = new MonitorConfig(); monitor.setVersion("1.0.0"); assertThat(monitor.getVersion(), equalTo("1.0.0")); } @Test - public void testParameters() throws Exception { + void testParameters() throws Exception { MonitorConfig monitor = new MonitorConfig(); Map parameters = Collections.singletonMap("k1", "v1"); monitor.setParameters(parameters); @@ -93,23 +93,23 @@ public class MonitorConfigTest { } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { MonitorConfig monitor = new MonitorConfig(); monitor.setDefault(true); assertThat(monitor.isDefault(), is(true)); } @Test - public void testInterval() throws Exception { + void testInterval() throws Exception { MonitorConfig monitor = new MonitorConfig(); monitor.setInterval("100"); assertThat(monitor.getInterval(), equalTo("100")); } @Test - public void testMetaData() { + void testMetaData() { MonitorConfig config = new MonitorConfig(); Map metaData = config.getMetaData(); Assertions.assertEquals(0, metaData.size(), "Expect empty metadata but found: "+metaData); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java index 5677e67c44..f63c9625fc 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java @@ -37,7 +37,7 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.is; -public class ProtocolConfigTest { +class ProtocolConfigTest { @BeforeEach public void setUp() { @@ -55,7 +55,7 @@ public class ProtocolConfigTest { } @Test - public void testName() throws Exception { + void testName() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); String protocolName = "xprotocol"; protocol.setName(protocolName); @@ -67,7 +67,7 @@ public class ProtocolConfigTest { } @Test - public void testHost() throws Exception { + void testHost() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setHost("host"); Map parameters = new HashMap(); @@ -77,7 +77,7 @@ public class ProtocolConfigTest { } @Test - public void testPort() throws Exception { + void testPort() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); int port = NetUtils.getAvailablePort(); protocol.setPort(port); @@ -88,7 +88,7 @@ public class ProtocolConfigTest { } @Test - public void testPath() throws Exception { + void testPath() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setContextpath("context-path"); Map parameters = new HashMap(); @@ -102,42 +102,42 @@ public class ProtocolConfigTest { } @Test - public void testCorethreads() throws Exception { + void testCorethreads() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setCorethreads(10); assertThat(protocol.getCorethreads(), is(10)); } @Test - public void testThreads() throws Exception { + void testThreads() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setThreads(10); assertThat(protocol.getThreads(), is(10)); } @Test - public void testIothreads() throws Exception { + void testIothreads() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setIothreads(10); assertThat(protocol.getIothreads(), is(10)); } @Test - public void testQueues() throws Exception { + void testQueues() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setQueues(10); assertThat(protocol.getQueues(), is(10)); } @Test - public void testAccepts() throws Exception { + void testAccepts() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setAccepts(10); assertThat(protocol.getAccepts(), is(10)); } @Test - public void testCodec() throws Exception { + void testCodec() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setName("dubbo"); protocol.setCodec("mockcodec"); @@ -145,98 +145,98 @@ public class ProtocolConfigTest { } @Test - public void testAccesslog() throws Exception { + void testAccesslog() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setAccesslog("access.log"); assertThat(protocol.getAccesslog(), equalTo("access.log")); } @Test - public void testTelnet() throws Exception { + void testTelnet() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setTelnet("mocktelnethandler"); assertThat(protocol.getTelnet(), equalTo("mocktelnethandler")); } @Test - public void testRegister() throws Exception { + void testRegister() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setRegister(true); assertThat(protocol.isRegister(), is(true)); } @Test - public void testTransporter() throws Exception { + void testTransporter() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setTransporter("mocktransporter"); assertThat(protocol.getTransporter(), equalTo("mocktransporter")); } @Test - public void testExchanger() throws Exception { + void testExchanger() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setExchanger("mockexchanger"); assertThat(protocol.getExchanger(), equalTo("mockexchanger")); } @Test - public void testDispatcher() throws Exception { + void testDispatcher() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setDispatcher("mockdispatcher"); assertThat(protocol.getDispatcher(), equalTo("mockdispatcher")); } @Test - public void testNetworker() throws Exception { + void testNetworker() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setNetworker("networker"); assertThat(protocol.getNetworker(), equalTo("networker")); } @Test - public void testParameters() throws Exception { + void testParameters() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setParameters(Collections.singletonMap("k1", "v1")); assertThat(protocol.getParameters(), hasEntry("k1", "v1")); } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setDefault(true); assertThat(protocol.isDefault(), is(true)); } @Test - public void testKeepAlive() throws Exception { + void testKeepAlive() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setKeepAlive(true); assertThat(protocol.getKeepAlive(), is(true)); } @Test - public void testOptimizer() throws Exception { + void testOptimizer() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setOptimizer("optimizer"); assertThat(protocol.getOptimizer(), equalTo("optimizer")); } @Test - public void testExtension() throws Exception { + void testExtension() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setExtension("extension"); assertThat(protocol.getExtension(), equalTo("extension")); } @Test - public void testMetaData() { + void testMetaData() { ProtocolConfig config = new ProtocolConfig(); Map metaData = config.getMetaData(); Assertions.assertEquals(0, metaData.size(), "actual: "+metaData); } @Test - public void testOverrideEmptyConfig() { + void testOverrideEmptyConfig() { int port = NetUtils.getAvailablePort(); //dubbo.protocol.name=rest //dubbo.protocol.port=port @@ -259,7 +259,7 @@ public class ProtocolConfigTest { } @Test - public void testOverrideConfigByName() { + void testOverrideConfigByName() { int port = NetUtils.getAvailablePort(); SysProps.setProperty("dubbo.protocols.rest.port", String.valueOf(port)); @@ -280,7 +280,7 @@ public class ProtocolConfigTest { } @Test - public void testOverrideConfigById() { + void testOverrideConfigById() { int port = NetUtils.getAvailablePort(); SysProps.setProperty("dubbo.protocols.rest1.name", "rest"); SysProps.setProperty("dubbo.protocols.rest1.port", String.valueOf(port)); @@ -303,7 +303,7 @@ public class ProtocolConfigTest { } @Test - public void testCreateConfigFromPropsWithId() { + void testCreateConfigFromPropsWithId() { int port1 = NetUtils.getAvailablePort(); int port2 = NetUtils.getAvailablePort(); SysProps.setProperty("dubbo.protocols.rest1.name", "rest"); @@ -331,7 +331,7 @@ public class ProtocolConfigTest { } @Test - public void testCreateConfigFromPropsWithName() { + void testCreateConfigFromPropsWithName() { int port1 = NetUtils.getAvailablePort(); int port2 = NetUtils.getAvailablePort(); SysProps.setProperty("dubbo.protocols.rest.port", String.valueOf(port1)); @@ -358,7 +358,7 @@ public class ProtocolConfigTest { } @Test - public void testCreateDefaultConfigFromProps() { + void testCreateDefaultConfigFromProps() { int port = NetUtils.getAvailablePort(); SysProps.setProperty("dubbo.protocol.name", "rest"); SysProps.setProperty("dubbo.protocol.port", String.valueOf(port)); @@ -385,4 +385,4 @@ public class ProtocolConfigTest { } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java index 5f5f08a0b3..dd534342db 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java @@ -30,17 +30,17 @@ import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; -public class ProviderConfigTest { +class ProviderConfigTest { @Test - public void testProtocol() throws Exception { + void testProtocol() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setProtocol("protocol"); assertThat(provider.getProtocol().getName(), equalTo("protocol")); } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setDefault(true); Map parameters = new HashMap(); @@ -50,7 +50,7 @@ public class ProviderConfigTest { } @Test - public void testHost() throws Exception { + void testHost() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setHost("demo-host"); Map parameters = new HashMap(); @@ -60,7 +60,7 @@ public class ProviderConfigTest { } @Test - public void testPort() throws Exception { + void testPort() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setPort(8080); Map parameters = new HashMap(); @@ -70,7 +70,7 @@ public class ProviderConfigTest { } @Test - public void testPath() throws Exception { + void testPath() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setPath("/path"); Map parameters = new HashMap(); @@ -81,7 +81,7 @@ public class ProviderConfigTest { } @Test - public void testContextPath() throws Exception { + void testContextPath() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setContextpath("/context-path"); Map parameters = new HashMap(); @@ -91,84 +91,84 @@ public class ProviderConfigTest { } @Test - public void testThreadpool() throws Exception { + void testThreadpool() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setThreadpool("mockthreadpool"); assertThat(provider.getThreadpool(), equalTo("mockthreadpool")); } @Test - public void testThreads() throws Exception { + void testThreads() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setThreads(10); assertThat(provider.getThreads(), is(10)); } @Test - public void testIothreads() throws Exception { + void testIothreads() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setIothreads(10); assertThat(provider.getIothreads(), is(10)); } @Test - public void testQueues() throws Exception { + void testQueues() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setQueues(10); assertThat(provider.getQueues(), is(10)); } @Test - public void testAccepts() throws Exception { + void testAccepts() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setAccepts(10); assertThat(provider.getAccepts(), is(10)); } @Test - public void testCharset() throws Exception { + void testCharset() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setCharset("utf-8"); assertThat(provider.getCharset(), equalTo("utf-8")); } @Test - public void testPayload() throws Exception { + void testPayload() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setPayload(10); assertThat(provider.getPayload(), is(10)); } @Test - public void testBuffer() throws Exception { + void testBuffer() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setBuffer(10); assertThat(provider.getBuffer(), is(10)); } @Test - public void testServer() throws Exception { + void testServer() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setServer("demo-server"); assertThat(provider.getServer(), equalTo("demo-server")); } @Test - public void testClient() throws Exception { + void testClient() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setClient("client"); assertThat(provider.getClient(), equalTo("client")); } @Test - public void testTelnet() throws Exception { + void testTelnet() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setTelnet("mocktelnethandler"); assertThat(provider.getTelnet(), equalTo("mocktelnethandler")); } @Test - public void testPrompt() throws Exception { + void testPrompt() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setPrompt("#"); Map parameters = new HashMap(); @@ -178,51 +178,51 @@ public class ProviderConfigTest { } @Test - public void testStatus() throws Exception { + void testStatus() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setStatus("mockstatuschecker"); assertThat(provider.getStatus(), equalTo("mockstatuschecker")); } @Test - public void testTransporter() throws Exception { + void testTransporter() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setTransporter("mocktransporter"); assertThat(provider.getTransporter(), equalTo("mocktransporter")); } @Test - public void testExchanger() throws Exception { + void testExchanger() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setExchanger("mockexchanger"); assertThat(provider.getExchanger(), equalTo("mockexchanger")); } @Test - public void testDispatcher() throws Exception { + void testDispatcher() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setDispatcher("mockdispatcher"); assertThat(provider.getDispatcher(), equalTo("mockdispatcher")); } @Test - public void testNetworker() throws Exception { + void testNetworker() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setNetworker("networker"); assertThat(provider.getNetworker(), equalTo("networker")); } @Test - public void testWait() throws Exception { + void testWait() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setWait(10); assertThat(provider.getWait(), equalTo(10)); } @Test - public void testMetaData() { + void testMetaData() { ProviderConfig config = new ProviderConfig(); Map metaData = config.getMetaData(); Assertions.assertEquals(0, metaData.size(), "Expect empty metadata but found: "+metaData); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java index 7d34883629..9000cfe2cf 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java @@ -16,13 +16,6 @@ */ package org.apache.dubbo.config; -import demo.MultiClassLoaderService; -import demo.MultiClassLoaderServiceImpl; -import demo.MultiClassLoaderServiceRequest; -import demo.MultiClassLoaderServiceResult; -import javassist.CannotCompileException; -import javassist.CtClass; -import javassist.NotFoundException; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.Version; import org.apache.dubbo.common.compiler.support.CtClassBuilder; @@ -52,6 +45,14 @@ import org.apache.dubbo.rpc.model.ServiceMetadata; import org.apache.dubbo.rpc.protocol.injvm.InjvmInvoker; import org.apache.dubbo.rpc.protocol.injvm.InjvmProtocol; import org.apache.dubbo.rpc.service.GenericService; + +import demo.MultiClassLoaderService; +import demo.MultiClassLoaderServiceImpl; +import demo.MultiClassLoaderServiceRequest; +import demo.MultiClassLoaderServiceResult; +import javassist.CannotCompileException; +import javassist.CtClass; +import javassist.NotFoundException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; @@ -121,7 +122,7 @@ import static org.apache.dubbo.rpc.Constants.SCOPE_LOCAL; import static org.apache.dubbo.rpc.Constants.SCOPE_REMOTE; import static org.apache.dubbo.rpc.cluster.Constants.PEER_KEY; -public class ReferenceConfigTest { +class ReferenceConfigTest { private static String zkUrl1; private static String zkUrl2; private static String registryUrl1; @@ -152,7 +153,7 @@ public class ReferenceConfigTest { * Test whether the configuration required for the aggregation service reference meets expectations */ @Test - public void testAppendConfig() { + void testAppendConfig() { ApplicationConfig applicationConfig = new ApplicationConfig(); applicationConfig.setName("application1"); @@ -393,7 +394,7 @@ public class ReferenceConfigTest { } @Test - public void testShouldJvmRefer() { + void testShouldJvmRefer() { Map parameters = new HashMap<>(); @@ -455,7 +456,7 @@ public class ReferenceConfigTest { } @Test - public void testCreateInvokerForLocalRefer() { + void testCreateInvokerForLocalRefer() { ReferenceConfig referenceConfig = new ReferenceConfig<>(); referenceConfig.setScope(LOCAL_KEY); @@ -493,7 +494,7 @@ public class ReferenceConfigTest { * Verify the configuration of the registry protocol for remote reference */ @Test - public void testCreateInvokerForRemoteRefer() { + void testCreateInvokerForRemoteRefer() { ReferenceConfig referenceConfig = new ReferenceConfig<>(); referenceConfig.setGeneric(Boolean.FALSE.toString()); @@ -538,7 +539,7 @@ public class ReferenceConfigTest { * Verify that the remote url is directly configured for remote reference */ @Test - public void testCreateInvokerWithRemoteUrlForRemoteRefer() { + void testCreateInvokerWithRemoteUrlForRemoteRefer() { ReferenceConfig referenceConfig = new ReferenceConfig<>(); referenceConfig.setGeneric(Boolean.FALSE.toString()); @@ -579,7 +580,7 @@ public class ReferenceConfigTest { * Verify that the registry url is directly configured for remote reference */ @Test - public void testCreateInvokerWithRegistryUrlForRemoteRefer() { + void testCreateInvokerWithRegistryUrlForRemoteRefer() { ReferenceConfig referenceConfig = new ReferenceConfig<>(); referenceConfig.setGeneric(Boolean.FALSE.toString()); @@ -619,7 +620,7 @@ public class ReferenceConfigTest { * Verify the service reference of multiple registries */ @Test - public void testMultipleRegistryForRemoteRefer() { + void testMultipleRegistryForRemoteRefer() { ReferenceConfig referenceConfig = new ReferenceConfig<>(); referenceConfig.setGeneric(Boolean.FALSE.toString()); referenceConfig.setProtocol("dubbo"); @@ -713,7 +714,7 @@ public class ReferenceConfigTest { * unit test for dubbo-1765 */ @Test - public void test1ReferenceRetry() { + void test1ReferenceRetry() { ApplicationConfig application = new ApplicationConfig(); application.setName("test-reference-retry"); application.setEnableFileCache(false); @@ -760,7 +761,7 @@ public class ReferenceConfigTest { } @Test - public void test2ReferenceRetry() { + void test2ReferenceRetry() { ApplicationConfig application = new ApplicationConfig(); application.setName("test-reference-retry2"); application.setEnableFileCache(false); @@ -811,7 +812,7 @@ public class ReferenceConfigTest { } @Test - public void testMetaData() { + void testMetaData() { ReferenceConfig config = new ReferenceConfig(); Map metaData = config.getMetaData(); Assertions.assertEquals(0, metaData.size(), "Expect empty metadata but found: " + metaData); @@ -831,7 +832,7 @@ public class ReferenceConfigTest { } @Test - public void testGetPrefixes() { + void testGetPrefixes() { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setInterface(DemoService.class); @@ -849,7 +850,7 @@ public class ReferenceConfigTest { } @Test - public void testGenericAndInterfaceConflicts() { + void testGenericAndInterfaceConflicts() { ReferenceConfig referenceConfig = new ReferenceConfig(); referenceConfig.setInterface(DemoService.class); @@ -865,7 +866,7 @@ public class ReferenceConfigTest { @Test - public void testLargeReferences() throws InterruptedException { + void testLargeReferences() throws InterruptedException { int amount = 10000; ModuleConfigManager configManager = DubboBootstrap.getInstance().getApplicationModel().getDefaultModule().getConfigManager(); @@ -945,7 +946,7 @@ public class ReferenceConfigTest { } @Test - public void testConstructWithReferenceAnnotation() throws NoSuchFieldException { + void testConstructWithReferenceAnnotation() throws NoSuchFieldException { Reference reference = getClass().getDeclaredField("innerTest").getAnnotation(Reference.class); ReferenceConfig referenceConfig = new ReferenceConfig(reference); Assertions.assertEquals(1, referenceConfig.getMethods().size()); @@ -963,7 +964,7 @@ public class ReferenceConfigTest { } @Test - public void testDifferentClassLoader() throws Exception { + void testDifferentClassLoader() throws Exception { ApplicationConfig applicationConfig = new ApplicationConfig("TestApp"); ApplicationModel applicationModel = new ApplicationModel(FrameworkModel.defaultModel()); applicationModel.getApplicationConfigManager().setApplication(applicationConfig); diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java index d8fd191a32..572665eac4 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java @@ -43,7 +43,7 @@ import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.not; -public class RegistryConfigTest { +class RegistryConfigTest { @BeforeEach public void beforeEach() { @@ -56,14 +56,14 @@ public class RegistryConfigTest { } @Test - public void testProtocol() throws Exception { + void testProtocol() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setProtocol("protocol"); assertThat(registry.getProtocol(), equalTo(registry.getProtocol())); } @Test - public void testAddress() throws Exception { + void testAddress() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setAddress("zookeeper://mrh:123@localhost:9103/registry?backup=localhost:9104&k1=v1"); assertThat(registry.getAddress(), equalTo("zookeeper://mrh:123@localhost:9103/registry?backup=localhost:9104&k1=v1")); @@ -77,21 +77,21 @@ public class RegistryConfigTest { } @Test - public void testUsername() throws Exception { + void testUsername() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setUsername("username"); assertThat(registry.getUsername(), equalTo("username")); } @Test - public void testPassword() throws Exception { + void testPassword() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setPassword("password"); assertThat(registry.getPassword(), equalTo("password")); } @Test - public void testWait() throws Exception { + void testWait() throws Exception { try { RegistryConfig registry = new RegistryConfig(); registry.setWait(10); @@ -103,91 +103,91 @@ public class RegistryConfigTest { } @Test - public void testCheck() throws Exception { + void testCheck() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setCheck(true); assertThat(registry.isCheck(), is(true)); } @Test - public void testFile() throws Exception { + void testFile() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setFile("file"); assertThat(registry.getFile(), equalTo("file")); } @Test - public void testTransporter() throws Exception { + void testTransporter() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setTransporter("transporter"); assertThat(registry.getTransporter(), equalTo("transporter")); } @Test - public void testClient() throws Exception { + void testClient() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setClient("client"); assertThat(registry.getClient(), equalTo("client")); } @Test - public void testTimeout() throws Exception { + void testTimeout() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setTimeout(10); assertThat(registry.getTimeout(), is(10)); } @Test - public void testSession() throws Exception { + void testSession() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setSession(10); assertThat(registry.getSession(), is(10)); } @Test - public void testDynamic() throws Exception { + void testDynamic() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setDynamic(true); assertThat(registry.isDynamic(), is(true)); } @Test - public void testRegister() throws Exception { + void testRegister() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setRegister(true); assertThat(registry.isRegister(), is(true)); } @Test - public void testSubscribe() throws Exception { + void testSubscribe() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setSubscribe(true); assertThat(registry.isSubscribe(), is(true)); } @Test - public void testCluster() throws Exception { + void testCluster() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setCluster("cluster"); assertThat(registry.getCluster(), equalTo("cluster")); } @Test - public void testGroup() throws Exception { + void testGroup() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setGroup("group"); assertThat(registry.getGroup(), equalTo("group")); } @Test - public void testVersion() throws Exception { + void testVersion() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setVersion("1.0.0"); assertThat(registry.getVersion(), equalTo("1.0.0")); } @Test - public void testParameters() throws Exception { + void testParameters() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setParameters(Collections.singletonMap("k1", "v1")); assertThat(registry.getParameters(), hasEntry("k1", "v1")); @@ -197,14 +197,14 @@ public class RegistryConfigTest { } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setDefault(true); assertThat(registry.isDefault(), is(true)); } @Test - public void testEquals() throws Exception { + void testEquals() throws Exception { RegistryConfig registry1 = new RegistryConfig(); RegistryConfig registry2 = new RegistryConfig(); registry1.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress2()); @@ -213,14 +213,14 @@ public class RegistryConfigTest { } @Test - public void testMetaData() { + void testMetaData() { RegistryConfig config = new RegistryConfig(); Map metaData = config.getMetaData(); Assertions.assertEquals(0, metaData.size(), "Expect empty metadata but found: " + metaData); } @Test - public void testOverrideConfigBySystemProps() { + void testOverrideConfigBySystemProps() { SysProps.setProperty("dubbo.registry.address", "zookeeper://${zookeeper.address}:${zookeeper.port}"); SysProps.setProperty("dubbo.registry.useAsConfigCenter", "false"); @@ -251,7 +251,7 @@ public class RegistryConfigTest { } @Test - public void testPreferredWithFalseValue() { + void testPreferredWithFalseValue() { RegistryConfig registry = new RegistryConfig(); registry.setPreferred(false); Map map = new HashMap<>(); @@ -262,4 +262,4 @@ public class RegistryConfigTest { Assertions.assertFalse(url.getParameter(PREFERRED_KEY, false)); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ServiceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ServiceConfigTest.java index ecec357d27..bb29c41299 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ServiceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ServiceConfigTest.java @@ -74,7 +74,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.times; import static org.mockito.Mockito.withSettings; -public class ServiceConfigTest { +class ServiceConfigTest { private Protocol protocolDelegate = Mockito.mock(Protocol.class); private Registry registryDelegate = Mockito.mock(Registry.class); private Exporter exporter = Mockito.mock(Exporter.class); @@ -156,7 +156,7 @@ public class ServiceConfigTest { } @Test - public void testExport() throws Exception { + void testExport() throws Exception { service.export(); assertThat(service.getExportedUrls(), hasSize(1)); @@ -179,7 +179,7 @@ public class ServiceConfigTest { } @Test - public void testVersionAndGroupConfigFromProvider() { + void testVersionAndGroupConfigFromProvider() { //Service no configuration version , the Provider configured. service.getProvider().setVersion("1.0.0"); service.getProvider().setGroup("groupA"); @@ -196,7 +196,7 @@ public class ServiceConfigTest { } @Test - public void testProxy() throws Exception { + void testProxy() throws Exception { service2.export(); assertThat(service2.getExportedUrls(), hasSize(1)); @@ -206,7 +206,7 @@ public class ServiceConfigTest { @Test - public void testDelayExport() throws Exception { + void testDelayExport() throws Exception { CountDownLatch latch = new CountDownLatch(1); delayService.addServiceListener(new ServiceListener() { @Override @@ -227,7 +227,7 @@ public class ServiceConfigTest { } @Test - public void testUnexport() throws Exception { + void testUnexport() throws Exception { System.setProperty(SHUTDOWN_WAIT_KEY, "0"); try { service.export(); @@ -240,7 +240,7 @@ public class ServiceConfigTest { } @Test - public void testInterfaceClass() throws Exception { + void testInterfaceClass() throws Exception { ServiceConfig service = new ServiceConfig<>(); service.setInterface(Greeting.class.getName()); service.setRef(Mockito.mock(Greeting.class)); @@ -251,7 +251,7 @@ public class ServiceConfigTest { } @Test - public void testInterface1() throws Exception { + void testInterface1() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> { ServiceConfig service = new ServiceConfig<>(); service.setInterface(DemoServiceImpl.class); @@ -259,14 +259,14 @@ public class ServiceConfigTest { } @Test - public void testInterface2() throws Exception { + void testInterface2() throws Exception { ServiceConfig service = new ServiceConfig<>(); service.setInterface(DemoService.class); assertThat(service.getInterface(), equalTo(DemoService.class.getName())); } @Test - public void testProvider() throws Exception { + void testProvider() throws Exception { ServiceConfig service = new ServiceConfig(); ProviderConfig provider = new ProviderConfig(); service.setProvider(provider); @@ -274,7 +274,7 @@ public class ServiceConfigTest { } @Test - public void testGeneric1() throws Exception { + void testGeneric1() throws Exception { ServiceConfig service = new ServiceConfig(); service.setGeneric(GENERIC_SERIALIZATION_DEFAULT); assertThat(service.getGeneric(), equalTo(GENERIC_SERIALIZATION_DEFAULT)); @@ -285,7 +285,7 @@ public class ServiceConfigTest { } @Test - public void testGeneric2() throws Exception { + void testGeneric2() throws Exception { Assertions.assertThrows(IllegalArgumentException.class, () -> { ServiceConfig service = new ServiceConfig(); service.setGeneric("illegal"); @@ -293,14 +293,14 @@ public class ServiceConfigTest { } @Test - public void testApplicationInUrl() { + void testApplicationInUrl() { service.export(); assertNotNull(service.toUrl().getApplication()); Assertions.assertEquals("app", service.toUrl().getApplication()); } @Test - public void testMetaData() { + void testMetaData() { // test new instance ServiceConfig config = new ServiceConfig(); Map metaData = config.getMetaData(); @@ -321,7 +321,7 @@ public class ServiceConfigTest { @Test - public void testExportWithoutRegistryConfig() { + void testExportWithoutRegistryConfig() { serviceWithoutRegistryConfig.export(); assertThat(serviceWithoutRegistryConfig.getExportedUrls(), hasSize(1)); @@ -344,7 +344,7 @@ public class ServiceConfigTest { } @Test - public void testServiceListener() { + void testServiceListener() { ExtensionLoader extensionLoader = ExtensionLoader.getExtensionLoader(ServiceListener.class); MockServiceListener mockServiceListener = (MockServiceListener) extensionLoader.getExtension("mock"); assertNotNull(mockServiceListener); @@ -360,7 +360,7 @@ public class ServiceConfigTest { @Test - public void testMethodConfigWithInvalidArgumentConfig() { + void testMethodConfigWithInvalidArgumentConfig() { Assertions.assertThrows(IllegalArgumentException.class, () -> { ServiceConfig service = new ServiceConfig<>(); @@ -383,7 +383,7 @@ public class ServiceConfigTest { } @Test - public void testMethodConfigWithConfiguredArgumentTypeAndIndex() { + void testMethodConfigWithConfiguredArgumentTypeAndIndex() { ServiceConfig service = new ServiceConfig<>(); service.setInterface(DemoService.class); @@ -409,7 +409,7 @@ public class ServiceConfigTest { } @Test - public void testMethodConfigWithConfiguredArgumentIndex() { + void testMethodConfigWithConfiguredArgumentIndex() { ServiceConfig service = new ServiceConfig<>(); service.setInterface(DemoService.class); @@ -434,7 +434,7 @@ public class ServiceConfigTest { } @Test - public void testMethodConfigWithConfiguredArgumentType() { + void testMethodConfigWithConfiguredArgumentType() { ServiceConfig service = new ServiceConfig<>(); service.setInterface(DemoService.class); @@ -459,7 +459,7 @@ public class ServiceConfigTest { } @Test - public void testMethodConfigWithUnknownArgumentType() { + void testMethodConfigWithUnknownArgumentType() { Assertions.assertThrows(IllegalArgumentException.class, () -> { ServiceConfig service = new ServiceConfig<>(); @@ -483,7 +483,7 @@ public class ServiceConfigTest { } @Test - public void testMethodConfigWithUnmatchedArgument() { + void testMethodConfigWithUnmatchedArgument() { Assertions.assertThrows(IllegalArgumentException.class, () -> { ServiceConfig service = new ServiceConfig<>(); @@ -507,7 +507,7 @@ public class ServiceConfigTest { } @Test - public void testMethodConfigWithInvalidArgumentIndex() { + void testMethodConfigWithInvalidArgumentIndex() { Assertions.assertThrows(IllegalArgumentException.class, () -> { ServiceConfig service = new ServiceConfig<>(); @@ -529,4 +529,4 @@ public class ServiceConfigTest { service.export(); }); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboBootstrapTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboBootstrapTest.java index 7b79bf0ade..f65b14d0ba 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboBootstrapTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/DubboBootstrapTest.java @@ -75,7 +75,7 @@ import static org.hamcrest.Matchers.is; * * @since 2.7.5 */ -public class DubboBootstrapTest { +class DubboBootstrapTest { private static File dubboProperties; private static String zkServerAddress; @@ -101,7 +101,7 @@ public class DubboBootstrapTest { } @Test - public void checkApplication() { + void checkApplication() { SysProps.setProperty("dubbo.application.name", "demo"); ApplicationConfig applicationConfig = new ApplicationConfig(); applicationConfig.refresh(); @@ -109,7 +109,7 @@ public class DubboBootstrapTest { } @Test - public void compatibleApplicationShutdown() { + void compatibleApplicationShutdown() { try { System.clearProperty(SHUTDOWN_WAIT_KEY); System.clearProperty(SHUTDOWN_WAIT_SECONDS_KEY); @@ -132,7 +132,7 @@ public class DubboBootstrapTest { } @Test - public void testLoadRegistries() { + void testLoadRegistries() { SysProps.setProperty("dubbo.registry.address", "addr1"); ServiceConfig serviceConfig = new ServiceConfig(); @@ -161,7 +161,7 @@ public class DubboBootstrapTest { } @Test - public void testLoadUserMonitor_address_only() { + void testLoadUserMonitor_address_only() { // -Ddubbo.monitor.address=monitor-addr:12080 SysProps.setProperty(DUBBO_MONITOR_ADDRESS, "monitor-addr:12080"); URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(new MonitorConfig()), new ServiceConfigURL("dubbo", "addr1", 9090)); @@ -173,7 +173,7 @@ public class DubboBootstrapTest { } @Test - public void testLoadUserMonitor_registry() { + void testLoadUserMonitor_registry() { // dubbo.monitor.protocol=registry MonitorConfig monitorConfig = new MonitorConfig(); monitorConfig.setProtocol("registry"); @@ -184,7 +184,7 @@ public class DubboBootstrapTest { } @Test - public void testLoadUserMonitor_service_discovery() { + void testLoadUserMonitor_service_discovery() { // dubbo.monitor.protocol=service-discovery-registry MonitorConfig monitorConfig = new MonitorConfig(); monitorConfig.setProtocol("service-discovery-registry"); @@ -195,13 +195,13 @@ public class DubboBootstrapTest { } @Test - public void testLoadUserMonitor_no_monitor() { + void testLoadUserMonitor_no_monitor() { URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(null), URL.valueOf(ZookeeperRegistryCenterConfig.getConnectionAddress())); Assertions.assertNull(url); } @Test - public void testLoadUserMonitor_user() { + void testLoadUserMonitor_user() { // dubbo.monitor.protocol=user MonitorConfig monitorConfig = new MonitorConfig(); monitorConfig.setProtocol("user"); @@ -211,7 +211,7 @@ public class DubboBootstrapTest { } @Test - public void testLoadUserMonitor_user_address() { + void testLoadUserMonitor_user_address() { // dubbo.monitor.address=user://1.2.3.4:5678?k=v MonitorConfig monitorConfig = new MonitorConfig(); monitorConfig.setAddress("user://1.2.3.4:5678?param1=value1"); @@ -231,7 +231,7 @@ public class DubboBootstrapTest { } @Test - public void testBootstrapStart() { + void testBootstrapStart() { ServiceConfig service = new ServiceConfig<>(); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); @@ -258,7 +258,7 @@ public class DubboBootstrapTest { } @Test - public void testLocalMetadataServiceExporter() { + void testLocalMetadataServiceExporter() { ServiceConfig service = new ServiceConfig<>(); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); @@ -278,7 +278,7 @@ public class DubboBootstrapTest { } @Test - public void testRemoteMetadataServiceExporter() { + void testRemoteMetadataServiceExporter() { ServiceConfig service = new ServiceConfig<>(); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); @@ -369,4 +369,4 @@ public class DubboBootstrapTest { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/MultiInstanceTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/MultiInstanceTest.java index ef1fa5d1ce..d14c5bc837 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/MultiInstanceTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/MultiInstanceTest.java @@ -61,7 +61,7 @@ import java.util.concurrent.Future; import static org.apache.dubbo.remoting.Constants.EVENT_LOOP_BOSS_POOL_NAME; -public class MultiInstanceTest { +class MultiInstanceTest { private static final Logger logger = LoggerFactory.getLogger(MultiInstanceTest.class); @@ -126,7 +126,7 @@ public class MultiInstanceTest { } @Test - public void testIsolatedApplications() { + void testIsolatedApplications() { DubboBootstrap dubboBootstrap1 = DubboBootstrap.newInstance(new FrameworkModel()); DubboBootstrap dubboBootstrap2 = DubboBootstrap.newInstance(new FrameworkModel()); @@ -153,7 +153,7 @@ public class MultiInstanceTest { } @Test - public void testDefaultProviderApplication() { + void testDefaultProviderApplication() { DubboBootstrap dubboBootstrap = DubboBootstrap.getInstance(); try { configProviderApp(dubboBootstrap).start(); @@ -164,7 +164,7 @@ public class MultiInstanceTest { } @Test - public void testDefaultConsumerApplication() { + void testDefaultConsumerApplication() { SysProps.setProperty("dubbo.consumer.check", "false"); DubboBootstrap dubboBootstrap = DubboBootstrap.getInstance(); try { @@ -180,7 +180,7 @@ public class MultiInstanceTest { } @Test - public void testDefaultMixedApplication() { + void testDefaultMixedApplication() { DubboBootstrap dubboBootstrap = DubboBootstrap.getInstance(); try { dubboBootstrap.application("mixed-app"); @@ -196,7 +196,7 @@ public class MultiInstanceTest { } @Test - public void testSharedApplications() { + void testSharedApplications() { FrameworkModel frameworkModel = new FrameworkModel(); DubboBootstrap dubboBootstrap1 = DubboBootstrap.newInstance(frameworkModel); @@ -218,7 +218,7 @@ public class MultiInstanceTest { } @Test - public void testMultiModuleApplication() throws InterruptedException { + void testMultiModuleApplication() throws InterruptedException { //SysProps.setProperty(METADATA_PUBLISH_DELAY_KEY, "100"); String version1 = "1.0"; @@ -307,7 +307,7 @@ public class MultiInstanceTest { } @Test - public void testMultiProviderApplicationsStopOneByOne() { + void testMultiProviderApplicationsStopOneByOne() { String version1 = "1.0"; String version2 = "2.0"; @@ -424,7 +424,7 @@ public class MultiInstanceTest { } @Test - public void testMultiModuleDeployAndReload() throws Exception { + void testMultiModuleDeployAndReload() throws Exception { String version1 = "1.0"; String version2 = "2.0"; @@ -567,7 +567,7 @@ public class MultiInstanceTest { } @Test - public void testBothStartByModuleAndByApplication() throws Exception { + void testBothStartByModuleAndByApplication() throws Exception { String version1 = "1.0"; String version2 = "2.0"; String version3 = "3.0"; @@ -647,7 +647,7 @@ public class MultiInstanceTest { @Test - public void testBothStartModuleAndApplicationNoWait() throws Exception { + void testBothStartModuleAndApplicationNoWait() throws Exception { String version1 = "1.0"; String version2 = "2.0"; String version3 = "3.0"; @@ -704,7 +704,7 @@ public class MultiInstanceTest { } @Test - public void testOldApiDeploy() throws Exception { + void testOldApiDeploy() throws Exception { try { // provider app @@ -780,7 +780,7 @@ public class MultiInstanceTest { } @Test - public void testAsyncExportAndReferServices() throws ExecutionException, InterruptedException { + void testAsyncExportAndReferServices() throws ExecutionException, InterruptedException { DubboBootstrap providerBootstrap = DubboBootstrap.newInstance(); DubboBootstrap consumerBootstrap = DubboBootstrap.newInstance(); try { @@ -925,4 +925,4 @@ public class MultiInstanceTest { deployEventMap.put(DeployState.FAILED, System.currentTimeMillis()); } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractBuilderTest.java index e2e7705791..428a93306f 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractBuilderTest.java @@ -114,4 +114,4 @@ class AbstractBuilderTest { private static class Config extends AbstractConfig { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractInterfaceBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractInterfaceBuilderTest.java index 157b73d318..e865ea46bb 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractInterfaceBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractInterfaceBuilderTest.java @@ -315,4 +315,4 @@ class AbstractInterfaceBuilderTest { private static class InterfaceConfig extends AbstractInterfaceConfig { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractMethodBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractMethodBuilderTest.java index faded90f11..fb2beb61cb 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractMethodBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractMethodBuilderTest.java @@ -192,4 +192,4 @@ class AbstractMethodBuilderTest { private static class MethodConfig extends AbstractMethodConfig { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractReferenceBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractReferenceBuilderTest.java index 349470c458..c066a16a31 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractReferenceBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractReferenceBuilderTest.java @@ -147,4 +147,4 @@ class AbstractReferenceBuilderTest { private static class ReferenceConfig extends AbstractReferenceConfig { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractServiceBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractServiceBuilderTest.java index 78631c53d8..ef8a9daa48 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractServiceBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/AbstractServiceBuilderTest.java @@ -241,4 +241,4 @@ class AbstractServiceBuilderTest { private static class ServiceConfig extends AbstractServiceConfig { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ApplicationBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ApplicationBuilderTest.java index 2b660814a8..f3b5517bd5 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ApplicationBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ApplicationBuilderTest.java @@ -284,4 +284,4 @@ class ApplicationBuilderTest { Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ArgumentBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ArgumentBuilderTest.java index 3fe6d31c5e..1b6638dd76 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ArgumentBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ArgumentBuilderTest.java @@ -60,4 +60,4 @@ class ArgumentBuilderTest { Assertions.assertNotSame(argument1, argument2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ConfigCenterBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ConfigCenterBuilderTest.java index f53691c019..e07db36fbc 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ConfigCenterBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ConfigCenterBuilderTest.java @@ -165,4 +165,4 @@ class ConfigCenterBuilderTest { Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ConsumerBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ConsumerBuilderTest.java index b0e3f89761..607388c7b2 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ConsumerBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ConsumerBuilderTest.java @@ -91,4 +91,4 @@ class ConsumerBuilderTest { Assertions.assertEquals(300, config.getShareconnections()); Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MetadataReportBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MetadataReportBuilderTest.java index 9aa966f1ee..9e3e718c6a 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MetadataReportBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MetadataReportBuilderTest.java @@ -147,4 +147,4 @@ class MetadataReportBuilderTest { Assertions.assertEquals("id", config.getId()); Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MethodBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MethodBuilderTest.java index 29a4813959..9196c48210 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MethodBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MethodBuilderTest.java @@ -186,4 +186,4 @@ class MethodBuilderTest { Assertions.assertEquals("serviceId", config.getServiceId()); Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ModuleBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ModuleBuilderTest.java index 1d6180066b..bbf7d2eb93 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ModuleBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ModuleBuilderTest.java @@ -109,4 +109,4 @@ class ModuleBuilderTest { Assertions.assertFalse(config.isDefault()); Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MonitorBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MonitorBuilderTest.java index f2e57de9ba..f63fd39d42 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MonitorBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/MonitorBuilderTest.java @@ -131,4 +131,4 @@ class MonitorBuilderTest { Assertions.assertEquals("id", config.getId()); Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ProtocolBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ProtocolBuilderTest.java index 9d9fed8c58..331d228f72 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ProtocolBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ProtocolBuilderTest.java @@ -334,4 +334,4 @@ class ProtocolBuilderTest { Assertions.assertEquals("id", config.getId()); Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ProviderBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ProviderBuilderTest.java index c383f1ad3a..f3cc1a6b22 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ProviderBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ProviderBuilderTest.java @@ -223,4 +223,4 @@ class ProviderBuilderTest { Assertions.assertEquals("id", config.getId()); Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ReferenceBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ReferenceBuilderTest.java index 833636b8bc..4d11ef4314 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ReferenceBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ReferenceBuilderTest.java @@ -122,4 +122,4 @@ class ReferenceBuilderTest { Assertions.assertEquals(1, config.getMethods().size()); Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/RegistryBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/RegistryBuilderTest.java index 9045419d67..eab629d0a5 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/RegistryBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/RegistryBuilderTest.java @@ -252,4 +252,4 @@ class RegistryBuilderTest { Assertions.assertEquals("id", config.getId()); Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ServiceBuilderTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ServiceBuilderTest.java index 82d8729d98..cb22a45cdf 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ServiceBuilderTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/bootstrap/builders/ServiceBuilderTest.java @@ -74,7 +74,7 @@ class ServiceBuilderTest { } @Test - public void generic() throws Exception { + void generic() throws Exception { ServiceBuilder builder = new ServiceBuilder(); builder.generic(GENERIC_SERIALIZATION_DEFAULT); assertThat(builder.build().getGeneric(), equalTo(GENERIC_SERIALIZATION_DEFAULT)); @@ -85,7 +85,7 @@ class ServiceBuilderTest { } @Test - public void generic1() throws Exception { + void generic1() throws Exception { Assertions.assertThrows(IllegalArgumentException.class, () -> { ServiceBuilder builder = new ServiceBuilder(); builder.generic("illegal").build(); @@ -128,4 +128,4 @@ class ServiceBuilderTest { Assertions.assertEquals(1, config.getMethods().size()); Assertions.assertNotSame(config, config2); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/cache/CacheTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/cache/CacheTest.java index e0dab84dce..688192b06b 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/cache/CacheTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/cache/CacheTest.java @@ -46,7 +46,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * CacheTest */ -public class CacheTest { +class CacheTest { @BeforeEach public void setUp() { @@ -118,17 +118,17 @@ public class CacheTest { } @Test - public void testCacheLru() throws Exception { + void testCacheLru() throws Exception { testCache("lru"); } @Test - public void testCacheThreadlocal() throws Exception { + void testCacheThreadlocal() throws Exception { testCache("threadlocal"); } @Test - public void testCacheProvider() throws Exception { + void testCacheProvider() throws Exception { CacheFactory cacheFactory = ExtensionLoader.getExtensionLoader(CacheFactory.class).getAdaptiveExtension(); Map parameters = new HashMap(); @@ -141,4 +141,4 @@ public class CacheTest { assertTrue(cache instanceof ThreadLocalCache); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/IntegrationTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/IntegrationTest.java index a185231fb8..2e3067affa 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/IntegrationTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/IntegrationTest.java @@ -25,4 +25,4 @@ public interface IntegrationTest { * Run the integration testcases. */ void integrate(); -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/exportmetadata/MultipleRegistryCenterExportMetadataIntegrationTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/exportmetadata/MultipleRegistryCenterExportMetadataIntegrationTest.java index 06e951e2b0..28a644bff7 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/exportmetadata/MultipleRegistryCenterExportMetadataIntegrationTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/exportmetadata/MultipleRegistryCenterExportMetadataIntegrationTest.java @@ -46,7 +46,7 @@ import static org.apache.dubbo.rpc.Constants.SCOPE_LOCAL; /** * The testcases are only for checking the process of exporting metadata service. */ -public class MultipleRegistryCenterExportMetadataIntegrationTest implements IntegrationTest { +class MultipleRegistryCenterExportMetadataIntegrationTest implements IntegrationTest { private static final Logger logger = LoggerFactory.getLogger(MultipleRegistryCenterExportMetadataIntegrationTest.class); @@ -178,4 +178,4 @@ public class MultipleRegistryCenterExportMetadataIntegrationTest implements Inte serviceListener = null; logger.info(getClass().getSimpleName() + " testcase is ending..."); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/exportprovider/MultipleRegistryCenterExportProviderIntegrationTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/exportprovider/MultipleRegistryCenterExportProviderIntegrationTest.java index a98fa5817c..bbf5277ebc 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/exportprovider/MultipleRegistryCenterExportProviderIntegrationTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/exportprovider/MultipleRegistryCenterExportProviderIntegrationTest.java @@ -47,7 +47,7 @@ import java.io.IOException; /** * The testcases are only for checking the core process of exporting provider. */ -public class MultipleRegistryCenterExportProviderIntegrationTest implements IntegrationTest { +class MultipleRegistryCenterExportProviderIntegrationTest implements IntegrationTest { private static final Logger logger = LoggerFactory.getLogger(MultipleRegistryCenterExportProviderIntegrationTest.class); @@ -244,4 +244,4 @@ public class MultipleRegistryCenterExportProviderIntegrationTest implements Inte logger.info(getClass().getSimpleName() + " testcase is ending..."); registryProtocolListener = null; } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/injvm/MultipleRegistryCenterInjvmIntegrationTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/injvm/MultipleRegistryCenterInjvmIntegrationTest.java index cdc3adf10a..3f5df17128 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/injvm/MultipleRegistryCenterInjvmIntegrationTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/injvm/MultipleRegistryCenterInjvmIntegrationTest.java @@ -43,7 +43,7 @@ import static org.apache.dubbo.rpc.Constants.SCOPE_LOCAL; /** * The testcases are only for checking the process of exporting provider using injvm protocol. */ -public class MultipleRegistryCenterInjvmIntegrationTest implements IntegrationTest { +class MultipleRegistryCenterInjvmIntegrationTest implements IntegrationTest { private static final Logger logger = LoggerFactory.getLogger(MultipleRegistryCenterInjvmIntegrationTest.class); @@ -189,4 +189,4 @@ public class MultipleRegistryCenterInjvmIntegrationTest implements IntegrationTe serviceListener = null; logger.info(getClass().getSimpleName() + " testcase is ending..."); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/servicediscoveryregistry/MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/servicediscoveryregistry/MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest.java index f27fcd71b3..d0047fe4ce 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/servicediscoveryregistry/MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/multiple/servicediscoveryregistry/MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest.java @@ -48,7 +48,7 @@ import static org.apache.dubbo.config.integration.Constants.MULTIPLE_CONFIG_CENT /** * The testcases are only for checking the process of exporting provider using service-discovery-registry protocol. */ -public class MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest implements IntegrationTest { +class MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest implements IntegrationTest { private static final Logger logger = LoggerFactory.getLogger(MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest.class); @@ -213,4 +213,4 @@ public class MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest imple registryServiceListener = null; logger.info(getClass().getSimpleName() + " testcase is ending..."); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/SingleRegistryCenterDubboProtocolIntegrationTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/SingleRegistryCenterDubboProtocolIntegrationTest.java index c4f1e866a0..b10835de23 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/SingleRegistryCenterDubboProtocolIntegrationTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/SingleRegistryCenterDubboProtocolIntegrationTest.java @@ -62,7 +62,7 @@ import static org.apache.dubbo.rpc.Constants.SCOPE_REMOTE; * This abstraction class will implement some methods as base for single registry center. */ @DisabledForJreRange(min = JRE.JAVA_16) -public class SingleRegistryCenterDubboProtocolIntegrationTest implements IntegrationTest { +class SingleRegistryCenterDubboProtocolIntegrationTest implements IntegrationTest { private static final Logger logger = LoggerFactory.getLogger(SingleRegistryCenterDubboProtocolIntegrationTest.class); /** @@ -370,4 +370,4 @@ public class SingleRegistryCenterDubboProtocolIntegrationTest implements Integra singleRegistryCenterExportedServiceListener = null; logger.info(getClass().getSimpleName() + " testcase is ending..."); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/exportmetadata/SingleRegistryCenterExportMetadataIntegrationTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/exportmetadata/SingleRegistryCenterExportMetadataIntegrationTest.java index 2f34c1f28f..3178b2e7e9 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/exportmetadata/SingleRegistryCenterExportMetadataIntegrationTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/exportmetadata/SingleRegistryCenterExportMetadataIntegrationTest.java @@ -46,7 +46,7 @@ import static org.apache.dubbo.rpc.Constants.SCOPE_LOCAL; /** * The testcases are only for checking the process of exporting metadata service. */ -public class SingleRegistryCenterExportMetadataIntegrationTest implements IntegrationTest { +class SingleRegistryCenterExportMetadataIntegrationTest implements IntegrationTest { private static final Logger logger = LoggerFactory.getLogger(SingleRegistryCenterExportMetadataIntegrationTest.class); @@ -174,4 +174,4 @@ public class SingleRegistryCenterExportMetadataIntegrationTest implements Integr serviceListener = null; logger.info(getClass().getSimpleName() + " testcase is ending..."); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/exportprovider/SingleRegistryCenterExportProviderIntegrationTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/exportprovider/SingleRegistryCenterExportProviderIntegrationTest.java index 16398b1436..50dca60a21 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/exportprovider/SingleRegistryCenterExportProviderIntegrationTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/exportprovider/SingleRegistryCenterExportProviderIntegrationTest.java @@ -53,7 +53,7 @@ import static org.apache.dubbo.rpc.Constants.SCOPE_LOCAL; /** * The testcases are only for checking the core process of exporting provider. */ -public class SingleRegistryCenterExportProviderIntegrationTest implements IntegrationTest { +class SingleRegistryCenterExportProviderIntegrationTest implements IntegrationTest { private static final Logger logger = LoggerFactory.getLogger(SingleRegistryCenterExportProviderIntegrationTest.class); @@ -244,4 +244,4 @@ public class SingleRegistryCenterExportProviderIntegrationTest implements Integr logger.info(getClass().getSimpleName() + " testcase is ending..."); registryProtocolListener = null; } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/injvm/SingleRegistryCenterInjvmIntegrationTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/injvm/SingleRegistryCenterInjvmIntegrationTest.java index fc414df712..62b72e80f3 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/injvm/SingleRegistryCenterInjvmIntegrationTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/integration/single/injvm/SingleRegistryCenterInjvmIntegrationTest.java @@ -43,7 +43,7 @@ import static org.apache.dubbo.rpc.Constants.SCOPE_LOCAL; /** * The testcases are only for checking the process of exporting provider using injvm protocol. */ -public class SingleRegistryCenterInjvmIntegrationTest implements IntegrationTest { +class SingleRegistryCenterInjvmIntegrationTest implements IntegrationTest { private static final Logger logger = LoggerFactory.getLogger(SingleRegistryCenterInjvmIntegrationTest.class); @@ -188,4 +188,4 @@ public class SingleRegistryCenterInjvmIntegrationTest implements IntegrationTest serviceListener = null; logger.info(getClass().getSimpleName() + " testcase is ending..."); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/invoker/DelegateProviderMetaDataInvokerTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/invoker/DelegateProviderMetaDataInvokerTest.java index a8cd43868a..70d3df05bd 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/invoker/DelegateProviderMetaDataInvokerTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/invoker/DelegateProviderMetaDataInvokerTest.java @@ -29,7 +29,7 @@ import org.mockito.Mockito; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.sameInstance; -public class DelegateProviderMetaDataInvokerTest { +class DelegateProviderMetaDataInvokerTest { private ServiceConfig service; private Invoker invoker; @@ -40,7 +40,7 @@ public class DelegateProviderMetaDataInvokerTest { } @Test - public void testDelegate() throws Exception { + void testDelegate() throws Exception { DelegateProviderMetaDataInvoker delegate = new DelegateProviderMetaDataInvoker(invoker, service); delegate.getInterface(); @@ -57,4 +57,4 @@ public class DelegateProviderMetaDataInvokerTest { assertThat(delegate.getMetadata(), sameInstance(service)); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/metadata/MetadataServiceURLParamsMetadataCustomizerTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/metadata/MetadataServiceURLParamsMetadataCustomizerTest.java index 76380f276e..67f2122783 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/metadata/MetadataServiceURLParamsMetadataCustomizerTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/metadata/MetadataServiceURLParamsMetadataCustomizerTest.java @@ -26,7 +26,6 @@ import org.apache.dubbo.config.api.DemoService; import org.apache.dubbo.config.bootstrap.DubboBootstrap; import org.apache.dubbo.config.provider.impl.DemoServiceImpl; import org.apache.dubbo.registry.client.DefaultServiceInstance; -import org.apache.dubbo.registry.client.metadata.ServiceInstanceMetadataUtils; import org.apache.dubbo.rpc.model.ApplicationModel; import org.junit.jupiter.api.AfterEach; @@ -47,7 +46,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.TIMESTAMP_KEY; import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY; import static org.apache.dubbo.registry.client.metadata.ServiceInstanceMetadataUtils.METADATA_SERVICE_URL_PARAMS_PROPERTY_NAME; -public class MetadataServiceURLParamsMetadataCustomizerTest { +class MetadataServiceURLParamsMetadataCustomizerTest { public DefaultServiceInstance instance; private URL metadataServiceURL = URL.valueOf("dubbo://10.225.12.124:2002/org.apache.dubbo.metadata.MetadataService" + @@ -70,7 +69,7 @@ public class MetadataServiceURLParamsMetadataCustomizerTest { } @Test - public void test() { + void test() { DubboBootstrap providerBootstrap = DubboBootstrap.newInstance(); ServiceConfig serviceConfig = new ServiceConfig<>(); serviceConfig.setInterface(DemoService.class); diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/nested/AggregationConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/nested/AggregationConfigTest.java index b24f49cc32..76c9d504a8 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/nested/AggregationConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/nested/AggregationConfigTest.java @@ -21,26 +21,26 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class AggregationConfigTest { +class AggregationConfigTest { @Test - public void testEnabled() { + void testEnabled() { AggregationConfig aggregationConfig = new AggregationConfig(); aggregationConfig.setEnabled(true); assertThat(aggregationConfig.getEnabled(), equalTo(true)); } @Test - public void testBucketNum() { + void testBucketNum() { AggregationConfig aggregationConfig = new AggregationConfig(); aggregationConfig.setBucketNum(5); assertThat(aggregationConfig.getBucketNum(), equalTo(5)); } @Test - public void testTimeWindowSeconds() { + void testTimeWindowSeconds() { AggregationConfig aggregationConfig = new AggregationConfig(); aggregationConfig.setTimeWindowSeconds(120); assertThat(aggregationConfig.getTimeWindowSeconds(), equalTo(120)); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/nested/PrometheusConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/nested/PrometheusConfigTest.java index 7dc3518803..d78f2732f7 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/nested/PrometheusConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/nested/PrometheusConfigTest.java @@ -21,10 +21,10 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class PrometheusConfigTest { +class PrometheusConfigTest { @Test - public void testExporter() { + void testExporter() { PrometheusConfig prometheusConfig = new PrometheusConfig(); PrometheusConfig.Exporter exporter = new PrometheusConfig.Exporter(); @@ -43,7 +43,7 @@ public class PrometheusConfigTest { } @Test - public void testPushgateway() { + void testPushgateway() { PrometheusConfig prometheusConfig = new PrometheusConfig(); PrometheusConfig.Pushgateway pushgateway = new PrometheusConfig.Pushgateway(); @@ -62,4 +62,4 @@ public class PrometheusConfigTest { assertThat(prometheusConfig.getPushgateway().getJob(), equalTo("job")); assertThat(prometheusConfig.getPushgateway().getPushInterval(), equalTo(30)); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/url/ExporterSideConfigUrlTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/url/ExporterSideConfigUrlTest.java index f5adf5050f..c07201b78e 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/url/ExporterSideConfigUrlTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/url/ExporterSideConfigUrlTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; -public class ExporterSideConfigUrlTest extends UrlTestBase { +class ExporterSideConfigUrlTest extends UrlTestBase { private static final Logger log = LoggerFactory.getLogger(ExporterSideConfigUrlTest.class); @@ -53,23 +53,23 @@ public class ExporterSideConfigUrlTest extends UrlTestBase { } @Test - public void exporterMethodConfigUrlTest() { + void exporterMethodConfigUrlTest() { verifyExporterUrlGeneration(methodConfForService, methodConfForServiceTable); } @Test - public void exporterServiceConfigUrlTest() { + void exporterServiceConfigUrlTest() { verifyExporterUrlGeneration(servConf, servConfTable); } @Test - public void exporterProviderConfigUrlTest() { + void exporterProviderConfigUrlTest() { verifyExporterUrlGeneration(provConf, provConfTable); } @Test - public void exporterRegistryConfigUrlTest() { + void exporterRegistryConfigUrlTest() { //verifyExporterUrlGeneration(regConfForService, regConfForServiceTable); } @@ -99,4 +99,4 @@ public class ExporterSideConfigUrlTest extends UrlTestBase { //////////////////////////////////////////////////////////// servConf.unexport(); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/url/InvokerSideConfigUrlTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/url/InvokerSideConfigUrlTest.java index 5e932c6aa8..5994f7e535 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/url/InvokerSideConfigUrlTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/url/InvokerSideConfigUrlTest.java @@ -36,7 +36,7 @@ import java.util.Arrays; import static org.apache.dubbo.rpc.Constants.SCOPE_REMOTE; @Disabled -public class InvokerSideConfigUrlTest extends UrlTestBase { +class InvokerSideConfigUrlTest extends UrlTestBase { private static final Logger log = LoggerFactory.getLogger(InvokerSideConfigUrlTest.class); // ====================================================== @@ -147,18 +147,18 @@ public class InvokerSideConfigUrlTest extends UrlTestBase { @Test - public void consumerConfUrlTest() { + void consumerConfUrlTest() { verifyInvokerUrlGeneration(consumerConf, consumerConfTable); } @Test - public void refConfUrlTest() { + void refConfUrlTest() { verifyInvokerUrlGeneration(refConf, refConfTable); } @Disabled("parameter on register center will not be merged any longer with query parameter request from the consumer") @Test - public void regConfForConsumerUrlTest() { + void regConfForConsumerUrlTest() { verifyInvokerUrlGeneration(regConfForConsumer, regConfForConsumerTable); } @@ -214,4 +214,4 @@ public class InvokerSideConfigUrlTest extends UrlTestBase { private String getSubscribedUrlString() { return MockRegistry.getSubscribedUrl().toString(); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/utils/ConfigValidationUtilsTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/utils/ConfigValidationUtilsTest.java index 03d4ce58c4..b98c46ec9d 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/utils/ConfigValidationUtilsTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/utils/ConfigValidationUtilsTest.java @@ -23,6 +23,7 @@ import org.apache.dubbo.config.MetadataReportConfig; import org.apache.dubbo.config.api.Greeting; import org.apache.dubbo.config.mock.GreetingMock1; import org.apache.dubbo.config.mock.GreetingMock2; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.MockedStatic; @@ -39,11 +40,11 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -public class ConfigValidationUtilsTest { +class ConfigValidationUtilsTest { @Test - public void checkMock1() { + void checkMock1() { Assertions.assertThrows(IllegalStateException.class, () -> { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setMock("return {a, b}"); @@ -53,7 +54,7 @@ public class ConfigValidationUtilsTest { } @Test - public void checkMock2() { + void checkMock2() { Assertions.assertThrows(IllegalStateException.class, () -> { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setMock(GreetingMock1.class.getName()); @@ -62,7 +63,7 @@ public class ConfigValidationUtilsTest { } @Test - public void checkMock3() { + void checkMock3() { Assertions.assertThrows(IllegalStateException.class, () -> { InterfaceConfig interfaceConfig = new InterfaceConfig(); interfaceConfig.setMock(GreetingMock2.class.getName()); @@ -71,7 +72,7 @@ public class ConfigValidationUtilsTest { } @Test - public void testValidateMetadataConfig() { + void testValidateMetadataConfig() { MetadataReportConfig config = new MetadataReportConfig(); config.setAddress("protocol://ip:host"); try { @@ -96,7 +97,7 @@ public class ConfigValidationUtilsTest { } @Test - public void testValidateApplicationConfig() throws Exception { + void testValidateApplicationConfig() throws Exception { try (MockedStatic mockedStatic = Mockito.mockStatic(ConfigValidationUtils.class);) { mockedStatic.when(() -> ConfigValidationUtils.validateApplicationConfig(any())).thenCallRealMethod(); ApplicationConfig config = new ApplicationConfig(); @@ -127,7 +128,7 @@ public class ConfigValidationUtilsTest { } @Test - public void testCheckQosInApplicationConfig() throws Exception { + void testCheckQosInApplicationConfig() throws Exception { ConfigValidationUtils mock = Mockito.mock(ConfigValidationUtils.class); ErrorTypeAwareLogger loggerMock = Mockito.mock(ErrorTypeAwareLogger.class); injectField(mock.getClass().getDeclaredField("logger"), loggerMock); diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/utils/ReferenceCacheTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/utils/ReferenceCacheTest.java index 8b9bac95e5..22ad45a7ac 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/utils/ReferenceCacheTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/utils/ReferenceCacheTest.java @@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ReferenceCacheTest { +class ReferenceCacheTest { @BeforeEach public void setUp() throws Exception { @@ -39,7 +39,7 @@ public class ReferenceCacheTest { } @Test - public void testGetCacheSameReference() throws Exception { + void testGetCacheSameReference() throws Exception { ReferenceCache cache = SimpleReferenceCache.getCache(); MockReferenceConfig config = buildMockReferenceConfig("org.apache.dubbo.config.utils.service.FooService", "group1", "1.0.0"); assertEquals(0L, config.getCounter()); @@ -58,7 +58,7 @@ public class ReferenceCacheTest { } @Test - public void testGetCacheDiffReference() throws Exception { + void testGetCacheDiffReference() throws Exception { ReferenceCache cache = SimpleReferenceCache.getCache(); MockReferenceConfig config = buildMockReferenceConfig("org.apache.dubbo.config.utils.service.FooService", "group1", "1.0.0"); assertEquals(0L, config.getCounter()); @@ -76,7 +76,7 @@ public class ReferenceCacheTest { } @Test - public void testGetCacheWithKey() throws Exception { + void testGetCacheWithKey() throws Exception { ReferenceCache cache = SimpleReferenceCache.getCache(); MockReferenceConfig config = buildMockReferenceConfig("org.apache.dubbo.config.utils.service.FooService", "group1", "1.0.0"); FooService value = cache.get(config); @@ -84,7 +84,7 @@ public class ReferenceCacheTest { } @Test - public void testGetCacheDiffName() throws Exception { + void testGetCacheDiffName() throws Exception { SimpleReferenceCache cache = SimpleReferenceCache.getCache(); MockReferenceConfig config = buildMockReferenceConfig("org.apache.dubbo.config.utils.service.FooService", "group1", "1.0.0"); assertEquals(0L, config.getCounter()); @@ -102,7 +102,7 @@ public class ReferenceCacheTest { } @Test - public void testDestroy() throws Exception { + void testDestroy() throws Exception { SimpleReferenceCache cache = SimpleReferenceCache.getCache(); MockReferenceConfig config = buildMockReferenceConfig("org.apache.dubbo.config.utils.service.FooService", "group1", "1.0.0"); cache.get(config); @@ -118,7 +118,7 @@ public class ReferenceCacheTest { } @Test - public void testDestroyAll() throws Exception { + void testDestroyAll() throws Exception { SimpleReferenceCache cache = SimpleReferenceCache.getCache(); MockReferenceConfig config = buildMockReferenceConfig("org.apache.dubbo.config.utils.service.FooService", "group1", "1.0.0"); cache.get(config); @@ -153,4 +153,4 @@ public class ReferenceCacheTest { return config; } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/metadata/MetadataServiceExporterTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/metadata/MetadataServiceExporterTest.java index dbaf02f41b..93869ad63d 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/metadata/MetadataServiceExporterTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/metadata/MetadataServiceExporterTest.java @@ -253,4 +253,4 @@ // return (ExporterDeployListener)model.getExtensionLoader(ApplicationDeployListener.class).getExtension("exporter"); // } // -//} +//} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java index 3889988c52..938504aaf4 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java @@ -113,7 +113,7 @@ public class ConfigTest { } @Test - public void testServiceClass() { + void testServiceClass() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/service-class.xml"); try { ctx.start(); @@ -221,7 +221,7 @@ public class ConfigTest { } @Test - public void testMultiProtocol() { + void testMultiProtocol() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/multi-protocol.xml"); try { @@ -358,7 +358,7 @@ public class ConfigTest { } @Test - public void testRmiTimeout() throws Exception { + void testRmiTimeout() throws Exception { System.clearProperty("sun.rmi.transport.tcp.responseTimeout"); ConsumerConfig consumer = new ConsumerConfig(); consumer.setTimeout(1000); @@ -408,7 +408,7 @@ public class ConfigTest { } @Test - public void testAppendFilter() throws Exception { + void testAppendFilter() throws Exception { ApplicationConfig application = new ApplicationConfig("provider"); ProviderConfig provider = new ProviderConfig(); @@ -457,7 +457,7 @@ public class ConfigTest { } @Test - public void testInitReference() throws Exception { + void testInitReference() throws Exception { ClassPathXmlApplicationContext providerContext = new ClassPathXmlApplicationContext( resourcePath + "/demo-provider.xml", resourcePath + "/demo-provider-properties.xml"); @@ -524,7 +524,7 @@ public class ConfigTest { // DUBBO-571 methods key in provider's URLONE doesn't contain the methods from inherited super interface @Test - public void test_noMethodInterface_methodsKeyHasValue() throws Exception { + void test_noMethodInterface_methodsKeyHasValue() throws Exception { List urls = null; ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/demo-provider-no-methods-interface.xml"); try { @@ -550,7 +550,7 @@ public class ConfigTest { // DUBBO-147 find all invoker instances which have been tried from RpcContext @Disabled("waiting-to-fix") @Test - public void test_RpcContext_getUrls() throws Exception { + void test_RpcContext_getUrls() throws Exception { ClassPathXmlApplicationContext providerContext = new ClassPathXmlApplicationContext( resourcePath + "/demo-provider-long-waiting.xml"); @@ -707,7 +707,7 @@ public class ConfigTest { } @Test - public void testSystemPropertyOverrideProtocol() throws Exception { + void testSystemPropertyOverrideProtocol() throws Exception { SysProps.setProperty("dubbo.protocols.tri.port", ""); // empty config should be ignored SysProps.setProperty("dubbo.protocols.dubbo.port", "20812"); // override success SysProps.setProperty("dubbo.protocol.port", "20899"); // override fail @@ -723,7 +723,7 @@ public class ConfigTest { } @Test - public void testSystemPropertyOverrideMultiProtocol() throws Exception { + void testSystemPropertyOverrideMultiProtocol() throws Exception { SysProps.setProperty("dubbo.protocols.dubbo.port", "20814"); SysProps.setProperty("dubbo.protocols.tri.port", "10914"); ClassPathXmlApplicationContext providerContext = new ClassPathXmlApplicationContext(resourcePath + @@ -795,7 +795,7 @@ public class ConfigTest { } @Test - public void testSystemPropertyOverrideReferenceConfig() throws Exception { + void testSystemPropertyOverrideReferenceConfig() throws Exception { SysProps.setProperty("dubbo.reference.org.apache.dubbo.config.spring.api.DemoService.retries", "5"); SysProps.setProperty("dubbo.consumer.check", "false"); SysProps.setProperty("dubbo.consumer.timeout", "1234"); @@ -1009,7 +1009,7 @@ public class ConfigTest { } @Test - public void testDubboProtocolPortOverride() throws Exception { + void testDubboProtocolPortOverride() throws Exception { int port = NetUtils.getAvailablePort(); SysProps.setProperty("dubbo.protocol.port", String.valueOf(port)); ServiceConfig service = null; @@ -1119,7 +1119,7 @@ public class ConfigTest { } @Test - public void testGenericServiceConfig() throws Exception { + void testGenericServiceConfig() throws Exception { ServiceConfig service = new ServiceConfig(); service.setRegistry(new RegistryConfig("mock://localhost")); service.setInterface(DemoService.class.getName()); @@ -1143,7 +1143,7 @@ public class ConfigTest { } @Test - public void testGenericServiceConfigThroughSpring() throws Exception { + void testGenericServiceConfigThroughSpring() throws Exception { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/generic-export.xml"); try { ctx.start(); diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/JavaConfigBeanTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/JavaConfigBeanTest.java index 03fc75431a..769271248a 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/JavaConfigBeanTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/JavaConfigBeanTest.java @@ -44,7 +44,7 @@ import org.springframework.context.annotation.Configuration; import java.util.Collection; import java.util.Map; -public class JavaConfigBeanTest { +class JavaConfigBeanTest { private static final String MY_PROTOCOL_ID = "myProtocol"; private static final String MY_REGISTRY_ID = "my-registry"; @@ -60,7 +60,7 @@ public class JavaConfigBeanTest { } @Test - public void testBean() { + void testBean() { SysProps.setProperty("dubbo.application.owner", "Tom"); SysProps.setProperty("dubbo.application.qos-enable", "false"); @@ -178,4 +178,4 @@ public class JavaConfigBeanTest { return new DemoServiceImpl(); } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ServiceBeanTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ServiceBeanTest.java index d77cc7584d..f4fe893a49 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ServiceBeanTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ServiceBeanTest.java @@ -28,7 +28,7 @@ import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.mockito.Mockito.mock; -public class ServiceBeanTest { +class ServiceBeanTest { @BeforeEach public void setUp() { @@ -41,7 +41,7 @@ public class ServiceBeanTest { } @Test - public void testGetService() { + void testGetService() { TestService service = mock(TestService.class); ServiceBean serviceBean = new ServiceBean(service); @@ -52,4 +52,4 @@ public class ServiceBeanTest { abstract class TestService implements Service { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/DubboConfigAliasPostProcessorTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/DubboConfigAliasPostProcessorTest.java index 2e3f47adf4..b8c610df35 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/DubboConfigAliasPostProcessorTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/DubboConfigAliasPostProcessorTest.java @@ -18,19 +18,20 @@ package org.apache.dubbo.config.spring.beans.factory.annotation; import org.apache.dubbo.config.ApplicationConfig; import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -public class DubboConfigAliasPostProcessorTest { +class DubboConfigAliasPostProcessorTest { private static final String APP_NAME = "APP_NAME"; private static final String APP_ID = "APP_ID"; @Test - public void test() { + void test() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TestConfigurationX.class); try { context.start(); diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MergedAnnotationTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MergedAnnotationTest.java index 8abe1da276..3a4f4886b6 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MergedAnnotationTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MergedAnnotationTest.java @@ -29,10 +29,10 @@ import org.springframework.util.ReflectionUtils; import java.lang.reflect.Field; -public class MergedAnnotationTest { +class MergedAnnotationTest { @Test - public void testMergedReference() { + void testMergedReference() { Field field = ReflectionUtils.findField(TestBean1.class, "demoService"); Reference reference = AnnotatedElementUtils.getMergedAnnotation(field, Reference.class); Assertions.assertEquals("dubbo", reference.group()); @@ -45,7 +45,7 @@ public class MergedAnnotationTest { } @Test - public void testMergedService() { + void testMergedService() { Service service1 = AnnotatedElementUtils.getMergedAnnotation(DemoServiceImpl1.class, Service.class); Assertions.assertEquals("dubbo", service1.group()); Assertions.assertEquals("1.0.0", service1.version()); @@ -73,4 +73,4 @@ public class MergedAnnotationTest { private DemoService demoService; } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MethodConfigCallbackTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MethodConfigCallbackTest.java index 1ac71b4860..9722e3cce9 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MethodConfigCallbackTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/MethodConfigCallbackTest.java @@ -52,7 +52,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; }) @EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) -public class MethodConfigCallbackTest { +class MethodConfigCallbackTest { @BeforeAll public static void beforeAll() { @@ -84,7 +84,7 @@ public class MethodConfigCallbackTest { private HelloService helloServiceMethodCallBack2; @Test - public void testMethodAnnotationCallBack() { + void testMethodAnnotationCallBack() { int threadCnt = Math.min(4, Runtime.getRuntime().availableProcessors()); int callCnt = 2 * threadCnt; for (int i = 0; i < threadCnt; i++) { @@ -130,4 +130,4 @@ public class MethodConfigCallbackTest { } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ParameterConvertTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ParameterConvertTest.java index cf100223de..a5bf17bb7c 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ParameterConvertTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ParameterConvertTest.java @@ -29,10 +29,10 @@ import java.util.Map; * {@link DubboAnnotationUtils#convertParameters} Test */ @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) -public class ParameterConvertTest { +class ParameterConvertTest { @Test - public void test() { + void test() { /** * (array->map) * ["a","b"] ==> {a=b} @@ -63,4 +63,4 @@ public class ParameterConvertTest { Assertions.assertEquals(parametersMap, DubboAnnotationUtils.convertParameters(new String[]{"a", "0,100"})); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java index b913f61fed..06d0592668 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceAnnotationBeanPostProcessorTest.java @@ -78,7 +78,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER "consumer.url = dubbo://127.0.0.1:12345?version=2.5.7", }) @EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true) -public class ReferenceAnnotationBeanPostProcessorTest { +class ReferenceAnnotationBeanPostProcessorTest { @BeforeAll public static void setUp() { @@ -138,7 +138,7 @@ public class ReferenceAnnotationBeanPostProcessorTest { private HelloService renamedHelloService2; @Test - public void testAop() throws Exception { + void testAop() throws Exception { Assertions.assertTrue(context.containsBean("helloService")); @@ -182,7 +182,7 @@ public class ReferenceAnnotationBeanPostProcessorTest { } @Test - public void testGetInjectedFieldReferenceBeanMap() { + void testGetInjectedFieldReferenceBeanMap() { ReferenceAnnotationBeanPostProcessor beanPostProcessor = getReferenceAnnotationBeanPostProcessor(); @@ -215,7 +215,7 @@ public class ReferenceAnnotationBeanPostProcessorTest { } @Test - public void testGetInjectedMethodReferenceBeanMap() { + void testGetInjectedMethodReferenceBeanMap() { ReferenceAnnotationBeanPostProcessor beanPostProcessor = getReferenceAnnotationBeanPostProcessor(); @@ -245,7 +245,7 @@ public class ReferenceAnnotationBeanPostProcessorTest { } @Test - public void testReferenceBeansMethodAnnotation() { + void testReferenceBeansMethodAnnotation() { ReferenceBeanManager referenceBeanManager = context.getBean(ReferenceBeanManager.BEAN_NAME, ReferenceBeanManager.class); @@ -350,4 +350,4 @@ public class ReferenceAnnotationBeanPostProcessorTest { } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceCreatorTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceCreatorTest.java index 0db3ce4ea8..60533b195d 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceCreatorTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ReferenceCreatorTest.java @@ -69,7 +69,7 @@ import static org.springframework.util.ReflectionUtils.findField; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = {ReferenceCreatorTest.class, ReferenceCreatorTest.ConsumerConfiguration.class}) @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) -public class ReferenceCreatorTest { +class ReferenceCreatorTest { private static final String MODULE_CONFIG_ID = "mymodule"; private static final String CONSUMER_CONFIG_ID = "myconsumer"; @@ -122,7 +122,7 @@ public class ReferenceCreatorTest { } @Test - public void testBuild() throws Exception { + void testBuild() throws Exception { Field helloServiceField = findField(getClass(), "helloService"); DubboReference reference = findAnnotation(helloServiceField, DubboReference.class); @@ -244,4 +244,4 @@ public class ReferenceCreatorTest { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationPostProcessorTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationPostProcessorTest.java index a4d26bfce5..52980c7f65 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationPostProcessorTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceAnnotationPostProcessorTest.java @@ -55,7 +55,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER "provider.package = org.apache.dubbo.config.spring.context.annotation.provider", }) @EnableDubbo(scanBasePackages = "${provider.package}") -public class ServiceAnnotationPostProcessorTest { +class ServiceAnnotationPostProcessorTest { @BeforeAll public static void setUp() { @@ -71,7 +71,7 @@ public class ServiceAnnotationPostProcessorTest { private ConfigurableListableBeanFactory beanFactory; @Test - public void test() { + void test() { Map helloServicesMap = beanFactory.getBeansOfType(HelloService.class); @@ -89,7 +89,7 @@ public class ServiceAnnotationPostProcessorTest { } @Test - public void testMethodAnnotation() { + void testMethodAnnotation() { Map serviceBeansMap = beanFactory.getBeansOfType(ServiceBean.class); @@ -106,4 +106,4 @@ public class ServiceAnnotationPostProcessorTest { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceBeanNameBuilderTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceBeanNameBuilderTest.java index 5bbbeaf80c..7f9cf28bb0 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceBeanNameBuilderTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/annotation/ServiceBeanNameBuilderTest.java @@ -38,7 +38,7 @@ import static org.apache.dubbo.config.spring.beans.factory.annotation.ServiceBea */ @Service(interfaceClass = DemoService.class, group = GROUP, version = VERSION, application = "application", module = "module", registry = {"1", "2", "3"}) -public class ServiceBeanNameBuilderTest { +class ServiceBeanNameBuilderTest { @Reference(interfaceClass = DemoService.class, group = "DUBBO", version = "${dubbo.version}", application = "application", module = "module", registry = {"1", "2", "3"}) @@ -57,7 +57,7 @@ public class ServiceBeanNameBuilderTest { } @Test - public void testServiceAnnotation() { + void testServiceAnnotation() { Service service = AnnotationUtils.getAnnotation(ServiceBeanNameBuilderTest.class, Service.class); ServiceBeanNameBuilder builder = ServiceBeanNameBuilder.create(service, INTERFACE_CLASS, environment); Assertions.assertEquals("ServiceBean:org.apache.dubbo.config.spring.api.DemoService:1.0.0:DUBBO", @@ -65,7 +65,7 @@ public class ServiceBeanNameBuilderTest { } @Test - public void testReferenceAnnotation() { + void testReferenceAnnotation() { Reference reference = AnnotationUtils.getAnnotation(ReflectionUtils.findField(ServiceBeanNameBuilderTest.class, "INTERFACE_CLASS"), Reference.class); ServiceBeanNameBuilder builder = ServiceBeanNameBuilder.create(reference, INTERFACE_CLASS, environment); Assertions.assertEquals("ServiceBean:org.apache.dubbo.config.spring.api.DemoService:1.0.0:DUBBO", @@ -73,7 +73,7 @@ public class ServiceBeanNameBuilderTest { } @Test - public void testServiceNameBuild() { + void testServiceNameBuild() { ServiceBeanNameBuilder vBuilder = ServiceBeanNameBuilder.create(INTERFACE_CLASS, environment); String vBeanName = vBuilder.version("DUBBO").build(); @@ -82,4 +82,4 @@ public class ServiceBeanNameBuilderTest { Assertions.assertNotEquals(vBeanName, gBeanName); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigDefaultPropertyValueBeanPostProcessorTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigDefaultPropertyValueBeanPostProcessorTest.java index d8299e0482..cdd05ff839 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigDefaultPropertyValueBeanPostProcessorTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/DubboConfigDefaultPropertyValueBeanPostProcessorTest.java @@ -19,15 +19,16 @@ package org.apache.dubbo.config.spring.beans.factory.config; import org.apache.dubbo.config.ApplicationConfig; import org.apache.dubbo.config.ProtocolConfig; import org.apache.dubbo.config.spring.context.annotation.provider.ProviderConfiguration; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; -public class DubboConfigDefaultPropertyValueBeanPostProcessorTest { +class DubboConfigDefaultPropertyValueBeanPostProcessorTest { @Test - public void test() { + void test() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ProviderConfiguration.class); try { context.start(); diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/MultipleServicesWithMethodConfigsTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/MultipleServicesWithMethodConfigsTest.java index 625337168f..b9caff8a84 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/MultipleServicesWithMethodConfigsTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/MultipleServicesWithMethodConfigsTest.java @@ -38,7 +38,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER @ContextConfiguration(classes = MultipleServicesWithMethodConfigsTest.class) @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) @ImportResource(locations = "classpath:/META-INF/spring/multiple-services-with-methods.xml") -public class MultipleServicesWithMethodConfigsTest { +class MultipleServicesWithMethodConfigsTest { @BeforeAll public static void setUp() { @@ -49,7 +49,7 @@ public class MultipleServicesWithMethodConfigsTest { private ApplicationContext applicationContext; @Test - public void test() { + void test() { Map serviceBeanMap = applicationContext.getBeansOfType(ServiceBean.class); for (ServiceBean serviceBean : serviceBeanMap.values()) { @@ -58,4 +58,3 @@ public class MultipleServicesWithMethodConfigsTest { } } - diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/YamlPropertySourceFactoryTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/YamlPropertySourceFactoryTest.java index faf98ae86e..a0f6b9eace 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/YamlPropertySourceFactoryTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/YamlPropertySourceFactoryTest.java @@ -40,7 +40,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER @Configuration @ContextConfiguration(classes = YamlPropertySourceFactoryTest.class) @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) -public class YamlPropertySourceFactoryTest { +class YamlPropertySourceFactoryTest { @Autowired private Environment environment; @@ -64,7 +64,7 @@ public class YamlPropertySourceFactoryTest { private Integer queues; @Test - public void testProperty() { + void testProperty() { Assertions.assertEquals(isDefault, environment.getProperty("dubbo.consumer.default", Boolean.class)); Assertions.assertEquals(client, environment.getProperty("dubbo.consumer.client", String.class)); Assertions.assertEquals(threadPool, environment.getProperty("dubbo.consumer.threadpool", String.class)); @@ -72,4 +72,4 @@ public class YamlPropertySourceFactoryTest { Assertions.assertEquals(threads, environment.getProperty("dubbo.consumer.threads", Integer.class)); Assertions.assertEquals(queues, environment.getProperty("dubbo.consumer.queues", Integer.class)); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional1/XmlReferenceBeanConditionalTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional1/XmlReferenceBeanConditionalTest.java index c18b64f7f8..468d1e0fd5 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional1/XmlReferenceBeanConditionalTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional1/XmlReferenceBeanConditionalTest.java @@ -47,7 +47,7 @@ import java.util.Map; ) @Configuration //@ComponentScan -public class XmlReferenceBeanConditionalTest { +class XmlReferenceBeanConditionalTest { @BeforeAll public static void beforeAll(){ @@ -66,7 +66,7 @@ public class XmlReferenceBeanConditionalTest { private ApplicationContext applicationContext; @Test - public void testConsumer() { + void testConsumer() { Map helloServiceMap = applicationContext.getBeansOfType(HelloService.class); Assertions.assertEquals(1, helloServiceMap.size()); @@ -97,4 +97,4 @@ public class XmlReferenceBeanConditionalTest { }; } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional2/JavaConfigAnnotationReferenceBeanConditionalTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional2/JavaConfigAnnotationReferenceBeanConditionalTest.java index ec4c71cc48..04adaba2dc 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional2/JavaConfigAnnotationReferenceBeanConditionalTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional2/JavaConfigAnnotationReferenceBeanConditionalTest.java @@ -53,7 +53,7 @@ import java.util.Map; @Configuration //@ComponentScan @EnableDubbo -public class JavaConfigAnnotationReferenceBeanConditionalTest { +class JavaConfigAnnotationReferenceBeanConditionalTest { @BeforeAll public static void beforeAll(){ @@ -72,7 +72,7 @@ public class JavaConfigAnnotationReferenceBeanConditionalTest { private ApplicationContext applicationContext; @Test - public void testConsumer() { + void testConsumer() { Map helloServiceMap = applicationContext.getBeansOfType(HelloService.class); Assertions.assertEquals(1, helloServiceMap.size()); @@ -105,4 +105,4 @@ public class JavaConfigAnnotationReferenceBeanConditionalTest { } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional3/JavaConfigRawReferenceBeanConditionalTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional3/JavaConfigRawReferenceBeanConditionalTest.java index ba5fa3ca70..d3fa5204e7 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional3/JavaConfigRawReferenceBeanConditionalTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/conditional3/JavaConfigRawReferenceBeanConditionalTest.java @@ -53,7 +53,7 @@ import java.util.Map; @Configuration //@ComponentScan @EnableDubbo -public class JavaConfigRawReferenceBeanConditionalTest { +class JavaConfigRawReferenceBeanConditionalTest { @BeforeAll public static void beforeAll(){ @@ -72,7 +72,7 @@ public class JavaConfigRawReferenceBeanConditionalTest { private ApplicationContext applicationContext; @Test - public void testConsumer() { + void testConsumer() { Map helloServiceMap = applicationContext.getBeansOfType(HelloService.class); Assertions.assertEquals(1, helloServiceMap.size()); @@ -107,4 +107,4 @@ public class JavaConfigRawReferenceBeanConditionalTest { } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootConfigPropsTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootConfigPropsTest.java index 4b7091189c..9ce1a7f5aa 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootConfigPropsTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootConfigPropsTest.java @@ -79,7 +79,7 @@ import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMET @Configuration @ComponentScan @EnableDubbo -public class SpringBootConfigPropsTest { +class SpringBootConfigPropsTest { @BeforeAll public static void beforeAll() { @@ -98,7 +98,7 @@ public class SpringBootConfigPropsTest { private ModuleModel moduleModel; @Test - public void testConfigProps() { + void testConfigProps() { ApplicationConfig applicationConfig = configManager.getApplicationOrElseThrow(); Assertions.assertEquals("dubbo-demo-application", applicationConfig.getName()); @@ -153,4 +153,4 @@ public class SpringBootConfigPropsTest { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootMultipleConfigPropsTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootMultipleConfigPropsTest.java index 1bf1a653b7..9bb31c119c 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootMultipleConfigPropsTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/configprops/SpringBootMultipleConfigPropsTest.java @@ -78,7 +78,7 @@ import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMET @Configuration @ComponentScan @EnableDubbo -public class SpringBootMultipleConfigPropsTest { +class SpringBootMultipleConfigPropsTest { @BeforeAll public static void beforeAll() { @@ -97,7 +97,7 @@ public class SpringBootMultipleConfigPropsTest { private ModuleModel moduleModel; @Test - public void testConfigProps() { + void testConfigProps() { ApplicationConfig applicationConfig = configManager.getApplicationOrElseThrow(); Assertions.assertEquals("dubbo-demo-application", applicationConfig.getName()); @@ -154,4 +154,4 @@ public class SpringBootMultipleConfigPropsTest { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml/SpringBootImportDubboXmlTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml/SpringBootImportDubboXmlTest.java index 39759783b9..d116d82f45 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml/SpringBootImportDubboXmlTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml/SpringBootImportDubboXmlTest.java @@ -41,7 +41,7 @@ import org.springframework.context.annotation.ImportResource; @Configuration @ComponentScan @ImportResource("classpath:/org/apache/dubbo/config/spring/boot/importxml/consumer/dubbo-consumer.xml") -public class SpringBootImportDubboXmlTest { +class SpringBootImportDubboXmlTest { @BeforeAll public static void beforeAll(){ @@ -57,7 +57,7 @@ public class SpringBootImportDubboXmlTest { private HelloService helloService; @Test - public void testConsumer() { + void testConsumer() { try { helloService.sayHello("dubbo"); Assertions.fail("Should not be called successfully"); @@ -68,4 +68,4 @@ public class SpringBootImportDubboXmlTest { } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml2/SpringBootImportAndScanTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml2/SpringBootImportAndScanTest.java index a13c44b9c3..4e5f5bec5e 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml2/SpringBootImportAndScanTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/boot/importxml2/SpringBootImportAndScanTest.java @@ -49,7 +49,7 @@ import java.util.Map; @ComponentScan @DubboComponentScan @ImportResource("classpath:/org/apache/dubbo/config/spring/boot/importxml2/dubbo-provider.xml") -public class SpringBootImportAndScanTest implements ApplicationContextAware { +class SpringBootImportAndScanTest implements ApplicationContextAware { private ApplicationContext applicationContext; @@ -67,7 +67,7 @@ public class SpringBootImportAndScanTest implements ApplicationContextAware { private HelloService helloService; @Test - public void testProvider() { + void testProvider() { String result = helloService.sayHello("dubbo"); Assertions.assertEquals("Hello, dubbo", result); @@ -95,4 +95,4 @@ public class SpringBootImportAndScanTest implements ApplicationContextAware { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/KeepRunningOnSpringClosedTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/KeepRunningOnSpringClosedTest.java index 4cc6908f5e..f09fa55082 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/KeepRunningOnSpringClosedTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/KeepRunningOnSpringClosedTest.java @@ -28,10 +28,10 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; -public class KeepRunningOnSpringClosedTest { +class KeepRunningOnSpringClosedTest { @Test - public void test(){ + void test(){ // set KeepRunningOnSpringClosed flag for next spring context DubboSpringInitCustomizerHolder.get().addCustomizer(context-> { @@ -78,4 +78,4 @@ public class KeepRunningOnSpringClosedTest { } } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboComponentScanRegistrarTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboComponentScanRegistrarTest.java index a12c1bb138..e165f933db 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboComponentScanRegistrarTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboComponentScanRegistrarTest.java @@ -37,7 +37,7 @@ import static org.springframework.core.annotation.AnnotationUtils.findAnnotation * * @since 2.5.8 */ -public class DubboComponentScanRegistrarTest { +class DubboComponentScanRegistrarTest { @BeforeEach public void setUp() { @@ -49,7 +49,7 @@ public class DubboComponentScanRegistrarTest { } @Test - public void test() { + void test() { AnnotationConfigApplicationContext providerContext = new AnnotationConfigApplicationContext(); @@ -126,4 +126,4 @@ public class DubboComponentScanRegistrarTest { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigConfigurationTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigConfigurationTest.java index 17a27f4a78..f4b705315e 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigConfigurationTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/DubboConfigConfigurationTest.java @@ -36,7 +36,7 @@ import java.io.IOException; * * @since 2.5.8 */ -public class DubboConfigConfigurationTest { +class DubboConfigConfigurationTest { private AnnotationConfigApplicationContext context; @@ -56,7 +56,7 @@ public class DubboConfigConfigurationTest { } @Test - public void testSingle() throws IOException { + void testSingle() throws IOException { context.register(DubboConfigConfiguration.Single.class); context.refresh(); @@ -80,7 +80,7 @@ public class DubboConfigConfigurationTest { } @Test - public void testMultiple() { + void testMultiple() { context.register(DubboConfigConfiguration.Multiple.class); context.refresh(); @@ -91,4 +91,4 @@ public class DubboConfigConfigurationTest { Assertions.assertEquals(2182, registry2.getPort()); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboConfigTest.java index 122a713a9e..803241d535 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboConfigTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboConfigTest.java @@ -44,7 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; * * @since 2.5.8 */ -public class EnableDubboConfigTest { +class EnableDubboConfigTest { @BeforeEach public void setUp() { @@ -137,4 +137,4 @@ public class EnableDubboConfigTest { private static class TestConfig { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboTest.java index 75ff827a66..74898c719c 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/annotation/EnableDubboTest.java @@ -48,7 +48,7 @@ import static org.springframework.core.annotation.AnnotationUtils.findAnnotation * * @since 2.5.8 */ -public class EnableDubboTest { +class EnableDubboTest { private AnnotationConfigApplicationContext context; @@ -65,7 +65,7 @@ public class EnableDubboTest { } @Test - public void testProvider() { + void testProvider() { context.register(TestProviderConfiguration.class); @@ -88,7 +88,7 @@ public class EnableDubboTest { } @Test - public void testConsumer() { + void testConsumer() { context.register(TestProviderConfiguration.class, TestConsumerConfiguration.class); context.refresh(); @@ -176,4 +176,4 @@ public class EnableDubboTest { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/customize/DubboSpringInitCustomizerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/customize/DubboSpringInitCustomizerTest.java index f8b98bc2fe..ed2178bde6 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/customize/DubboSpringInitCustomizerTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/customize/DubboSpringInitCustomizerTest.java @@ -32,7 +32,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; -public class DubboSpringInitCustomizerTest { +class DubboSpringInitCustomizerTest { @BeforeAll public static void beforeAll() { @@ -48,7 +48,7 @@ public class DubboSpringInitCustomizerTest { } @Test - public void testReloadSpringContext() { + void testReloadSpringContext() { ClassPathXmlApplicationContext providerContext1 = null; ClassPathXmlApplicationContext providerContext2 = null; @@ -105,4 +105,4 @@ public class DubboSpringInitCustomizerTest { } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/properties/DefaultDubboConfigBinderTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/properties/DefaultDubboConfigBinderTest.java index ea42e1fd44..73240d56f9 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/properties/DefaultDubboConfigBinderTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/context/properties/DefaultDubboConfigBinderTest.java @@ -38,7 +38,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER @TestPropertySource(locations = "classpath:/dubbo-binder.properties") @ContextConfiguration(classes = DefaultDubboConfigBinder.class) @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) -public class DefaultDubboConfigBinderTest { +class DefaultDubboConfigBinderTest { @BeforeAll public static void setUp() { @@ -49,7 +49,7 @@ public class DefaultDubboConfigBinderTest { private DubboConfigBinder dubboConfigBinder; @Test - public void testBinder() { + void testBinder() { ApplicationConfig applicationConfig = new ApplicationConfig(); dubboConfigBinder.bind("dubbo.application", applicationConfig); @@ -65,4 +65,4 @@ public class DefaultDubboConfigBinderTest { Assertions.assertEquals(Integer.valueOf(20881), protocolConfig.getPort()); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/extension/SpringExtensionInjectorTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/extension/SpringExtensionInjectorTest.java index 15bd67039f..c27f07595c 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/extension/SpringExtensionInjectorTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/extension/SpringExtensionInjectorTest.java @@ -36,7 +36,7 @@ import org.springframework.context.annotation.Configuration; @EnableDubbo(scanBasePackages = "") @Configuration -public class SpringExtensionInjectorTest { +class SpringExtensionInjectorTest { @BeforeEach public void init() { @@ -48,7 +48,7 @@ public class SpringExtensionInjectorTest { } @Test - public void testSpringInjector() { + void testSpringInjector() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); try { context.setDisplayName("Context1"); @@ -99,4 +99,4 @@ public class SpringExtensionInjectorTest { public ApplicationConfig applicationConfig() { return new ApplicationConfig("test-app"); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java index 3be2329f5b..4031af29aa 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6000/Issue6000Test.java @@ -37,7 +37,7 @@ import org.springframework.context.annotation.PropertySource; @EnableDubbo @ComponentScan @PropertySource("classpath:/META-INF/issues/issue6000/config.properties") -public class Issue6000Test { +class Issue6000Test { @BeforeAll public static void beforeAll() { @@ -50,7 +50,7 @@ public class Issue6000Test { } @Test - public void test() throws Exception { + void test() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Issue6000Test.class); try { @@ -67,4 +67,4 @@ public class Issue6000Test { } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6252/Issue6252Test.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6252/Issue6252Test.java index 51b6f145f9..8b1c332c67 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6252/Issue6252Test.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue6252/Issue6252Test.java @@ -36,7 +36,7 @@ import org.springframework.context.annotation.PropertySource; @Configuration @EnableDubboConfig @PropertySource("classpath:/META-INF/issues/issue6252/config.properties") -public class Issue6252Test { +class Issue6252Test { @BeforeAll public static void beforeAll() { @@ -52,7 +52,7 @@ public class Issue6252Test { private DemoService demoService; @Test - public void test() throws Exception { + void test() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Issue6252Test.class); try { DemoService demoService = context.getBean(DemoService.class); @@ -61,4 +61,4 @@ public class Issue6252Test { } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue7003/Issue7003Test.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue7003/Issue7003Test.java index 71edfbe6e3..c1e0ede149 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue7003/Issue7003Test.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue7003/Issue7003Test.java @@ -46,7 +46,7 @@ import java.util.Map; @EnableDubbo @ComponentScan @PropertySource("classpath:/META-INF/issues/issue7003/config.properties") -public class Issue7003Test { +class Issue7003Test { @BeforeAll public static void beforeAll() { @@ -59,7 +59,7 @@ public class Issue7003Test { } @Test - public void test() throws Exception { + void test() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Issue7003Test.class); try { @@ -90,4 +90,4 @@ public class Issue7003Test { private HelloService helloService; } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue9172/MultipleConsumerAndProviderTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue9172/MultipleConsumerAndProviderTest.java index 4e196b2210..716ba61a81 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue9172/MultipleConsumerAndProviderTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue9172/MultipleConsumerAndProviderTest.java @@ -37,10 +37,10 @@ import org.springframework.context.annotation.PropertySource; /** * Test for issue 9172 */ -public class MultipleConsumerAndProviderTest { +class MultipleConsumerAndProviderTest { @Test - public void test() { + void test() { AnnotationConfigApplicationContext providerContext = null; AnnotationConfigApplicationContext consumerContext = null; @@ -103,4 +103,4 @@ public class MultipleConsumerAndProviderTest { return new DemoServiceImpl(); } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue9207/ConfigCenterBeanTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue9207/ConfigCenterBeanTest.java index 78b891fe08..7d086cd199 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue9207/ConfigCenterBeanTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/issues/issue9207/ConfigCenterBeanTest.java @@ -44,13 +44,13 @@ import java.util.Map; import java.util.Properties; import java.util.stream.Collectors; -public class ConfigCenterBeanTest { +class ConfigCenterBeanTest { private static final String DUBBO_PROPERTIES_FILE = "/META-INF/issues/issue9207/dubbo-properties-in-configcenter.properties"; private static final String DUBBO_EXTERNAL_CONFIG_KEY = "my-dubbo.properties"; @Test - public void testConfigCenterBeanFromProps() throws IOException { + void testConfigCenterBeanFromProps() throws IOException { SysProps.setProperty("dubbo.config-center.include-spring-env", "true"); SysProps.setProperty("dubbo.config-center.config-file", DUBBO_EXTERNAL_CONFIG_KEY); @@ -106,4 +106,4 @@ public class ConfigCenterBeanTest { String content = reader.lines().collect(Collectors.joining("\n")); return content; } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer/PropertyConfigurerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer/PropertyConfigurerTest.java index a10435539b..77e757c84d 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer/PropertyConfigurerTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer/PropertyConfigurerTest.java @@ -33,7 +33,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import java.net.InetSocketAddress; -public class PropertyConfigurerTest { +class PropertyConfigurerTest { @BeforeAll public static void beforeAll() { @@ -46,7 +46,7 @@ public class PropertyConfigurerTest { } @Test - public void testEarlyInit() { + void testEarlyInit() { ClassPathXmlApplicationContext providerContext = new ClassPathXmlApplicationContext("org/apache/dubbo/config/spring/propertyconfigurer/provider/dubbo-provider.xml"); try { @@ -79,4 +79,4 @@ public class PropertyConfigurerTest { return new DemoBeanFactoryPostProcessor(service); } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer2/PropertySourcesConfigurerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer2/PropertySourcesConfigurerTest.java index 89e56a7d10..4dcb6b29b9 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer2/PropertySourcesConfigurerTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer2/PropertySourcesConfigurerTest.java @@ -34,7 +34,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import java.net.InetSocketAddress; -public class PropertySourcesConfigurerTest { +class PropertySourcesConfigurerTest { @BeforeAll public static void beforeAll() { @@ -47,7 +47,7 @@ public class PropertySourcesConfigurerTest { } @Test - public void testEarlyInit() { + void testEarlyInit() { ClassPathXmlApplicationContext providerContext = new ClassPathXmlApplicationContext("org/apache/dubbo/config/spring/propertyconfigurer/provider/dubbo-provider.xml"); try { @@ -81,4 +81,4 @@ public class PropertySourcesConfigurerTest { return new DemoBeanFactoryPostProcessor(service); } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer3/PropertySourcesInJavaConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer3/PropertySourcesInJavaConfigTest.java index 776d731661..b8128b3044 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer3/PropertySourcesInJavaConfigTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/propertyconfigurer/consumer3/PropertySourcesInJavaConfigTest.java @@ -38,7 +38,7 @@ import org.springframework.core.io.ClassPathResource; import java.io.IOException; import java.net.InetSocketAddress; -public class PropertySourcesInJavaConfigTest { +class PropertySourcesInJavaConfigTest { private static final String SCAN_PACKAGE_NAME = "org.apache.dubbo.config.spring.propertyconfigurer.consumer3.notexist"; private static final String PACKAGE_PATH = "/org/apache/dubbo/config/spring/propertyconfigurer/consumer3"; @@ -60,7 +60,7 @@ public class PropertySourcesInJavaConfigTest { } @Test - public void testImportPropertySource() { + void testImportPropertySource() { ClassPathXmlApplicationContext providerContext = new ClassPathXmlApplicationContext(PROVIDER_CONFIG_PATH); try { @@ -88,7 +88,7 @@ public class PropertySourcesInJavaConfigTest { } @Test - public void testCustomPropertySourceBean() { + void testCustomPropertySourceBean() { ClassPathXmlApplicationContext providerContext = new ClassPathXmlApplicationContext(PROVIDER_CONFIG_PATH); try { @@ -149,4 +149,4 @@ public class PropertySourcesInJavaConfigTest { return propertyValue; } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/DubboConfigBeanInitializerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/DubboConfigBeanInitializerTest.java index 16617a49dd..9afc815496 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/DubboConfigBeanInitializerTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/DubboConfigBeanInitializerTest.java @@ -58,7 +58,7 @@ import java.util.List; }) @EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) -public class DubboConfigBeanInitializerTest { +class DubboConfigBeanInitializerTest { @BeforeAll public static void beforeAll() { @@ -78,7 +78,7 @@ public class DubboConfigBeanInitializerTest { private ApplicationContext applicationContext; @Test - public void test() { + void test() { Assertions.assertNotNull(fooService, "fooService is null"); Assertions.assertNotNull(fooService.helloService, "ooService.helloService is null"); @@ -123,4 +123,4 @@ public class DubboConfigBeanInitializerTest { @Autowired private HelloService helloService; } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/ReferenceKeyTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/ReferenceKeyTest.java index ea48d2cf19..469bdaa381 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/ReferenceKeyTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/ReferenceKeyTest.java @@ -44,7 +44,7 @@ import java.io.StringWriter; import java.lang.reflect.Field; import java.util.Map; -public class ReferenceKeyTest { +class ReferenceKeyTest { @BeforeEach protected void setUp() { @@ -52,7 +52,7 @@ public class ReferenceKeyTest { } @Test - public void testReferenceKey() throws Exception { + void testReferenceKey() throws Exception { String helloService1 = getReferenceKey("helloService"); String helloService2 = getReferenceKey("helloService2"); @@ -98,7 +98,7 @@ public class ReferenceKeyTest { @Test - public void testConfig() { + void testConfig() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class); context.start(); @@ -127,7 +127,7 @@ public class ReferenceKeyTest { } @Test - public void testConfig3() { + void testConfig3() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration3.class); context.start(); Map referenceBeanMap = context.getBeansOfType(ReferenceBean.class); @@ -139,7 +139,7 @@ public class ReferenceKeyTest { } @Test - public void testConfig4() { + void testConfig4() { AnnotationConfigApplicationContext context = null; try { context = new AnnotationConfigApplicationContext(ConsumerConfiguration4.class); @@ -157,7 +157,7 @@ public class ReferenceKeyTest { } @Test - public void testConfig5() { + void testConfig5() { try { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration5.class); context.start(); @@ -169,7 +169,7 @@ public class ReferenceKeyTest { } @Test - public void testConfig6() { + void testConfig6() { try { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration6.class); context.start(); @@ -318,4 +318,4 @@ public class ReferenceKeyTest { // private HelloService helloService; } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/javaconfig/JavaConfigReferenceBeanTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/javaconfig/JavaConfigReferenceBeanTest.java index 474fad6590..af379ca7fe 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/javaconfig/JavaConfigReferenceBeanTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/javaconfig/JavaConfigReferenceBeanTest.java @@ -45,7 +45,7 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -public class JavaConfigReferenceBeanTest { +class JavaConfigReferenceBeanTest { @BeforeEach public void setUp() { @@ -58,7 +58,7 @@ public class JavaConfigReferenceBeanTest { } @Test - public void testAnnotationAtField() { + void testAnnotationAtField() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(CommonConfig.class, AnnotationAtFieldConfiguration.class); @@ -104,7 +104,7 @@ public class JavaConfigReferenceBeanTest { } @Test - public void testAnnotationBean() { + void testAnnotationBean() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(CommonConfig.class, AnnotationBeanConfiguration.class); @@ -126,7 +126,7 @@ public class JavaConfigReferenceBeanTest { } @Test - public void testGenericServiceAnnotationBean() { + void testGenericServiceAnnotationBean() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(CommonConfig.class, GenericServiceAnnotationBeanConfiguration.class); @@ -163,7 +163,7 @@ public class JavaConfigReferenceBeanTest { } @Test - public void testReferenceBean() { + void testReferenceBean() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(CommonConfig.class, ReferenceBeanConfiguration.class); @@ -188,7 +188,7 @@ public class JavaConfigReferenceBeanTest { } @Test - public void testGenericServiceReferenceBean() { + void testGenericServiceReferenceBean() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(CommonConfig.class, GenericServiceReferenceBeanConfiguration.class); @@ -215,7 +215,7 @@ public class JavaConfigReferenceBeanTest { } @Test - public void testRawReferenceBean() { + void testRawReferenceBean() { AnnotationConfigApplicationContext context = null; try { context = new AnnotationConfigApplicationContext(CommonConfig.class, ReferenceBeanWithoutGenericTypeConfiguration.class); @@ -234,7 +234,7 @@ public class JavaConfigReferenceBeanTest { } @Test - public void testInconsistentBean() { + void testInconsistentBean() { AnnotationConfigApplicationContext context = null; try { context = new AnnotationConfigApplicationContext(CommonConfig.class, InconsistentBeanConfiguration.class); @@ -252,7 +252,7 @@ public class JavaConfigReferenceBeanTest { } @Test - public void testMissingGenericTypeBean() { + void testMissingGenericTypeBean() { AnnotationConfigApplicationContext context = null; try { context = new AnnotationConfigApplicationContext(CommonConfig.class, MissingGenericTypeAnnotationBeanConfiguration.class); @@ -269,7 +269,7 @@ public class JavaConfigReferenceBeanTest { } @Test - public void testMissingInterfaceTypeBean() { + void testMissingInterfaceTypeBean() { AnnotationConfigApplicationContext context = null; try { context = new AnnotationConfigApplicationContext(CommonConfig.class, MissingInterfaceTypeAnnotationBeanConfiguration.class); @@ -435,4 +435,4 @@ public class JavaConfigReferenceBeanTest { } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java index eb5a8e5690..235e432ef6 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcall/LocalCallTest.java @@ -37,7 +37,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER @ContextConfiguration(locations = {"classpath:/org/apache/dubbo/config/spring/reference/localcall/local-call-provider.xml", "classpath:/org/apache/dubbo/config/spring/reference/localcall/local-call-consumer.xml"}) @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) -public class LocalCallTest { +class LocalCallTest { @BeforeAll public static void beforeAll() { @@ -57,7 +57,7 @@ public class LocalCallTest { private HelloService localHelloService; @Test - public void testLocalCall() { + void testLocalCall() { // see also: org.apache.dubbo.rpc.protocol.injvm.InjvmInvoker.doInvoke // InjvmInvoker set remote address to 127.0.0.1:0 String result = helloService.sayHello("world"); @@ -68,4 +68,4 @@ public class LocalCallTest { Assertions.assertEquals("Hello world, response from provider: null", originResult); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcalla/LocalCallReferenceAnnotationTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcalla/LocalCallReferenceAnnotationTest.java index a4e9466b98..9c3edd00fe 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcalla/LocalCallReferenceAnnotationTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcalla/LocalCallReferenceAnnotationTest.java @@ -45,7 +45,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER @PropertySource("classpath:/org/apache/dubbo/config/spring/reference/localcalla/local-call-config.properties") @ContextConfiguration(classes = {LocalCallReferenceAnnotationTest.class, LocalCallReferenceAnnotationTest.LocalCallConfiguration.class}) @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) -public class LocalCallReferenceAnnotationTest { +class LocalCallReferenceAnnotationTest { @BeforeAll public static void setUp() { @@ -64,7 +64,7 @@ public class LocalCallReferenceAnnotationTest { private ApplicationContext applicationContext; @Test - public void testLocalCall() { + void testLocalCall() { // see also: org.apache.dubbo.rpc.protocol.injvm.InjvmInvoker.doInvoke // InjvmInvoker set remote address to 127.0.0.1:0 String result = helloService.sayHello("world"); @@ -84,4 +84,4 @@ public class LocalCallReferenceAnnotationTest { return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress(); } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallam/LocalCallMultipleReferenceAnnotationsTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallam/LocalCallMultipleReferenceAnnotationsTest.java index 718b7514e2..f579e00076 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallam/LocalCallMultipleReferenceAnnotationsTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallam/LocalCallMultipleReferenceAnnotationsTest.java @@ -46,7 +46,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER @PropertySource("classpath:/org/apache/dubbo/config/spring/reference/localcallam/local-call-config.properties") @ContextConfiguration(classes = {LocalCallMultipleReferenceAnnotationsTest.class, LocalCallMultipleReferenceAnnotationsTest.LocalCallConfiguration.class}) @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) -public class LocalCallMultipleReferenceAnnotationsTest { +class LocalCallMultipleReferenceAnnotationsTest { @BeforeAll public static void setUp() { @@ -63,7 +63,7 @@ public class LocalCallMultipleReferenceAnnotationsTest { private ApplicationContext applicationContext; @Test - public void testLocalCall() { + void testLocalCall() { // see also: org.apache.dubbo.rpc.protocol.injvm.InjvmInvoker.doInvoke // InjvmInvoker set remote address to 127.0.0.1:0 String result = helloService.sayHello("world"); @@ -131,4 +131,4 @@ public class LocalCallMultipleReferenceAnnotationsTest { return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress(); } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallmix/LocalCallReferenceMixTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallmix/LocalCallReferenceMixTest.java index be3b274ac4..e05ef64b99 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallmix/LocalCallReferenceMixTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/reference/localcallmix/LocalCallReferenceMixTest.java @@ -47,7 +47,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER @ContextConfiguration(classes = {LocalCallReferenceMixTest.class, LocalCallReferenceMixTest.LocalCallConfiguration.class}) @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) @ImportResource("classpath:/org/apache/dubbo/config/spring/reference/localcallmix/local-call-consumer.xml") -public class LocalCallReferenceMixTest { +class LocalCallReferenceMixTest { @BeforeAll public static void setUp() { @@ -66,7 +66,7 @@ public class LocalCallReferenceMixTest { private ApplicationContext applicationContext; @Test - public void testLocalCall() { + void testLocalCall() { // see also: org.apache.dubbo.rpc.protocol.injvm.InjvmInvoker.doInvoke // InjvmInvoker set remote address to 127.0.0.1:0 String result = helloService.sayHello("world"); @@ -86,4 +86,4 @@ public class LocalCallReferenceMixTest { return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress(); } } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/nacos/nacos/NacosServiceNameTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/nacos/nacos/NacosServiceNameTest.java index 0ea50e6af0..58714a50e8 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/nacos/nacos/NacosServiceNameTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/registry/nacos/nacos/NacosServiceNameTest.java @@ -32,7 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.3 */ -public class NacosServiceNameTest { +class NacosServiceNameTest { private static final String category = DEFAULT_CATEGORY; @@ -53,7 +53,7 @@ public class NacosServiceNameTest { } @Test - public void testGetter() { + void testGetter() { assertEquals(category, name.getCategory()); assertEquals(serviceInterface, name.getServiceInterface()); assertEquals(version, name.getVersion()); @@ -62,12 +62,12 @@ public class NacosServiceNameTest { } @Test - public void testToString() { + void testToString() { assertEquals("providers:org.apache.dubbo.registry.nacos.NacosServiceName:1.0.0:default", name.toString()); } @Test - public void testIsConcrete() { + void testIsConcrete() { assertTrue(name.isConcrete()); @@ -86,7 +86,7 @@ public class NacosServiceNameTest { } @Test - public void testIsCompatible() { + void testIsCompatible() { NacosServiceName concrete = new NacosServiceName(); @@ -122,4 +122,4 @@ public class NacosServiceNameTest { name.setVersion(version + ",2.0.0"); assertTrue(name.isCompatible(concrete)); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java index 73ae2cbddb..9a0ec03c4d 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java @@ -57,7 +57,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class DubboNamespaceHandlerTest { +class DubboNamespaceHandlerTest { private static String resourcePath = ConfigTest.class.getPackage().getName().replace('.', '/'); @@ -79,7 +79,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testProviderXmlOnConfigurationClass() { + void testProviderXmlOnConfigurationClass() { AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); applicationContext.register(XmlConfiguration.class); applicationContext.refresh(); @@ -87,7 +87,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testProviderXml() { + void testProviderXml() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext( resourcePath + "/demo-provider.xml", resourcePath + "/demo-provider-properties.xml" @@ -124,7 +124,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testMultiProtocol() { + void testMultiProtocol() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/multi-protocol.xml"); ctx.start(); @@ -143,7 +143,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testDefaultProtocol() { + void testDefaultProtocol() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/override-protocol.xml"); ctx.start(); @@ -153,7 +153,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testCustomParameter() { + void testCustomParameter() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/customize-parameter.xml"); ctx.start(); @@ -168,7 +168,7 @@ public class DubboNamespaceHandlerTest { @Test - public void testDelayFixedTime() { + void testDelayFixedTime() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:/" + resourcePath + "/delay-fixed-time.xml"); ctx.start(); @@ -176,7 +176,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testTimeoutConfig() { + void testTimeoutConfig() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/provider-nested-service.xml"); ctx.start(); @@ -196,7 +196,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testMonitor() { + void testMonitor() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/provider-with-monitor.xml"); ctx.start(); @@ -220,7 +220,7 @@ public class DubboNamespaceHandlerTest { // } @Test - public void testModuleInfo() { + void testModuleInfo() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/provider-with-module.xml"); ctx.start(); @@ -229,7 +229,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testNotificationWithWrongBean() { + void testNotificationWithWrongBean() { Assertions.assertThrows(BeanCreationException.class, () -> { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/consumer-notification.xml"); ctx.start(); @@ -237,7 +237,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testProperty() { + void testProperty() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/service-class.xml"); ctx.start(); @@ -248,7 +248,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testMetricsAggregation() { + void testMetricsAggregation() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/metrics-aggregation.xml"); ctx.start(); @@ -269,7 +269,7 @@ public class DubboNamespaceHandlerTest { } @Test - public void testMetricsPrometheus() { + void testMetricsPrometheus() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(resourcePath + "/metrics-prometheus.xml"); ctx.start(); @@ -304,4 +304,4 @@ public class DubboNamespaceHandlerTest { assertEquals(metricsBean.getPrometheus().getPushgateway().getPassword(), "password"); assertEquals(metricsBean.getPrometheus().getPushgateway().getJob(), "job"); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceTest.java index 061130f43f..4103f9c569 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceTest.java @@ -42,7 +42,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER @ContextConfiguration(classes = GenericServiceTest.class) @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) @ImportResource(locations = "classpath:/META-INF/spring/dubbo-generic-consumer.xml") -public class GenericServiceTest { +class GenericServiceTest { @BeforeAll public static void beforeAll() { @@ -63,7 +63,7 @@ public class GenericServiceTest { private ServiceBean serviceBean; @Test - public void testGeneric() { + void testGeneric() { assertNotNull(demoServiceRef); assertNotNull(serviceBean); @@ -76,4 +76,4 @@ public class GenericServiceTest { Assertions.assertEquals("Welcome dubbo", result); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceWithoutInterfaceTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceWithoutInterfaceTest.java index e5a947f434..8fbb450817 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceWithoutInterfaceTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/GenericServiceWithoutInterfaceTest.java @@ -39,7 +39,7 @@ import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER @ContextConfiguration(classes = GenericServiceWithoutInterfaceTest.class) @DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) @ImportResource(locations = "classpath:/META-INF/spring/dubbo-generic-consumer-without-interface.xml") -public class GenericServiceWithoutInterfaceTest { +class GenericServiceWithoutInterfaceTest { @BeforeAll public static void beforeAll() { @@ -56,7 +56,7 @@ public class GenericServiceWithoutInterfaceTest { private GenericService genericServiceWithoutInterfaceRef; @Test - public void testGenericWithoutInterface() { + void testGenericWithoutInterface() { // Test generic service without interface class locally Object result = genericServiceWithoutInterfaceRef.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"generic"}); @@ -67,4 +67,4 @@ public class GenericServiceWithoutInterfaceTest { Assertions.assertEquals("org.apache.dubbo.config.spring.api.LocalMissClass", reference.getInterface()); Assertions.assertThrows(ClassNotFoundException.class, () -> ClassUtils.forName(reference.getInterface())); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/status/DataSourceStatusCheckerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/status/DataSourceStatusCheckerTest.java index 1606258a8f..14d74f4113 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/status/DataSourceStatusCheckerTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/status/DataSourceStatusCheckerTest.java @@ -41,7 +41,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.MockitoAnnotations.initMocks; -public class DataSourceStatusCheckerTest { +class DataSourceStatusCheckerTest { private DataSourceStatusChecker dataSourceStatusChecker; @Mock @@ -60,14 +60,14 @@ public class DataSourceStatusCheckerTest { } @Test - public void testWithoutApplicationContext() { + void testWithoutApplicationContext() { Status status = dataSourceStatusChecker.check(); assertThat(status.getLevel(), is(Status.Level.UNKNOWN)); } @Test - public void testWithoutDatasource() { + void testWithoutDatasource() { Map map = new HashMap(); given(applicationContext.getBeansOfType(eq(DataSource.class), anyBoolean(), anyBoolean())).willReturn(map); @@ -77,7 +77,7 @@ public class DataSourceStatusCheckerTest { } @Test - public void testWithDatasourceHasNextResult() throws SQLException { + void testWithDatasourceHasNextResult() throws SQLException { Map map = new HashMap(); DataSource dataSource = mock(DataSource.class); Connection connection = mock(Connection.class, Answers.RETURNS_DEEP_STUBS); @@ -92,7 +92,7 @@ public class DataSourceStatusCheckerTest { } @Test - public void testWithDatasourceNotHasNextResult() throws SQLException { + void testWithDatasourceNotHasNextResult() throws SQLException { Map map = new HashMap(); DataSource dataSource = mock(DataSource.class); Connection connection = mock(Connection.class, Answers.RETURNS_DEEP_STUBS); @@ -105,4 +105,4 @@ public class DataSourceStatusCheckerTest { assertThat(status.getLevel(), is(Status.Level.ERROR)); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/status/SpringStatusCheckerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/status/SpringStatusCheckerTest.java index 5eeb0cbeb9..da3fe0061b 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/status/SpringStatusCheckerTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/status/SpringStatusCheckerTest.java @@ -31,7 +31,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -public class SpringStatusCheckerTest { +class SpringStatusCheckerTest { // @Mock // private ApplicationLifeCycle applicationContext; @@ -47,7 +47,7 @@ public class SpringStatusCheckerTest { } @Test - public void testWithoutApplicationContext() { + void testWithoutApplicationContext() { SpringStatusChecker springStatusChecker = new SpringStatusChecker((ApplicationContext) null); Status status = springStatusChecker.check(); @@ -55,7 +55,7 @@ public class SpringStatusCheckerTest { } @Test - public void testWithLifeCycleRunning() { + void testWithLifeCycleRunning() { ApplicationLifeCycle applicationLifeCycle = mock(ApplicationLifeCycle.class); given(applicationLifeCycle.getConfigLocations()).willReturn(new String[]{"test1", "test2"}); given(applicationLifeCycle.isRunning()).willReturn(true); @@ -68,7 +68,7 @@ public class SpringStatusCheckerTest { } @Test - public void testWithoutLifeCycleRunning() { + void testWithoutLifeCycleRunning() { ApplicationLifeCycle applicationLifeCycle = mock(ApplicationLifeCycle.class); given(applicationLifeCycle.isRunning()).willReturn(false); @@ -84,7 +84,7 @@ public class SpringStatusCheckerTest { // TODO improve GenericWebApplicationContext test scenario @Test - public void testGenericWebApplicationContext() { + void testGenericWebApplicationContext() { GenericWebApplicationContext context = mock(GenericWebApplicationContext.class); given(context.isRunning()).willReturn(true); @@ -93,4 +93,4 @@ public class SpringStatusCheckerTest { Assertions.assertEquals(Status.Level.OK, status.getLevel()); } -} +} \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/EnvironmentUtilsTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/EnvironmentUtilsTest.java index f68dc089b5..96f995bba3 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/EnvironmentUtilsTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/util/EnvironmentUtilsTest.java @@ -36,10 +36,10 @@ import static org.apache.dubbo.config.spring.util.EnvironmentUtils.filterDubboPr * @see EnvironmentUtils * @since 2.7.0 */ -public class EnvironmentUtilsTest { +class EnvironmentUtilsTest { @Test - public void testExtraProperties() { + void testExtraProperties() { String key = "test.name"; System.setProperty(key, "Tom"); @@ -71,7 +71,7 @@ public class EnvironmentUtilsTest { } @Test - public void testFilterDubboProperties() { + void testFilterDubboProperties() { MockEnvironment environment = new MockEnvironment(); environment.setProperty("message", "Hello,World"); @@ -85,4 +85,4 @@ public class EnvironmentUtilsTest { Assertions.assertEquals("false", dubboProperties.get("dubbo.consumer.check")); } -} +} \ No newline at end of file diff --git a/dubbo-configcenter/dubbo-configcenter-apollo/src/test/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfigurationTest.java b/dubbo-configcenter/dubbo-configcenter-apollo/src/test/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfigurationTest.java index 6b2d3d2b42..a54ffd37ad 100644 --- a/dubbo-configcenter/dubbo-configcenter-apollo/src/test/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfigurationTest.java +++ b/dubbo-configcenter/dubbo-configcenter-apollo/src/test/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfigurationTest.java @@ -41,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.fail; * Notice: EmbeddedApollo(apollo mock server) only support < junit5, please not upgrade the junit version in this UT, * the junit version in this UT is junit4, and the dependency comes from apollo-mockserver. */ -public class ApolloDynamicConfigurationTest { +class ApolloDynamicConfigurationTest { private static final String SESSION_TIMEOUT_KEY = "session"; private static final String DEFAULT_NAMESPACE = "dubbo"; private static ApolloDynamicConfiguration apolloDynamicConfiguration; @@ -84,7 +84,7 @@ public class ApolloDynamicConfigurationTest { * Test get rule. */ @Test - public void testGetRule() { + void testGetRule() { String mockKey = "mockKey1"; String mockValue = String.valueOf(new Random().nextInt()); putMockRuleData(mockKey, mockValue, DEFAULT_NAMESPACE); @@ -101,7 +101,7 @@ public class ApolloDynamicConfigurationTest { * @throws InterruptedException the interrupted exception */ @Test - public void testGetInternalProperty() throws InterruptedException { + void testGetInternalProperty() throws InterruptedException { String mockKey = "mockKey2"; String mockValue = String.valueOf(new Random().nextInt()); putMockRuleData(mockKey, mockValue, DEFAULT_NAMESPACE); @@ -123,7 +123,7 @@ public class ApolloDynamicConfigurationTest { * @throws Exception the exception */ @Test - public void testAddListener() throws Exception { + void testAddListener() throws Exception { String mockKey = "mockKey3"; String mockValue = String.valueOf(new Random().nextInt()); @@ -187,4 +187,4 @@ public class ApolloDynamicConfigurationTest { } -} +} \ No newline at end of file diff --git a/dubbo-configcenter/dubbo-configcenter-nacos/src/test/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfigurationTest.java b/dubbo-configcenter/dubbo-configcenter-nacos/src/test/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfigurationTest.java index 4079a7d1cd..3f2bb525fd 100644 --- a/dubbo-configcenter/dubbo-configcenter-nacos/src/test/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfigurationTest.java +++ b/dubbo-configcenter/dubbo-configcenter-nacos/src/test/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfigurationTest.java @@ -44,7 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; */ //FIXME: waiting for embedded Nacos suport, then we can open the switch. @Disabled("https://github.com/alibaba/nacos/issues/1188") -public class NacosDynamicConfigurationTest { +class NacosDynamicConfigurationTest { private static final String SESSION_TIMEOUT_KEY = "session"; private static NacosDynamicConfiguration config; @@ -55,7 +55,7 @@ public class NacosDynamicConfigurationTest { private static ConfigService nacosClient; @Test - public void testGetConfig() throws Exception { + void testGetConfig() throws Exception { put("org.apache.dubbo.nacos.testService.configurators", "hello"); Thread.sleep(200); put("dubbo.properties", "test", "aaa=bbb"); @@ -68,7 +68,7 @@ public class NacosDynamicConfigurationTest { } @Test - public void testAddListener() throws Exception { + void testAddListener() throws Exception { CountDownLatch latch = new CountDownLatch(4); TestListener listener1 = new TestListener(latch); TestListener listener2 = new TestListener(latch); @@ -143,7 +143,7 @@ public class NacosDynamicConfigurationTest { } @Test - public void testPublishConfig() { + void testPublishConfig() { String key = "user-service"; String group = "org.apache.dubbo.service.UserService"; String content = "test"; @@ -184,4 +184,4 @@ public class NacosDynamicConfigurationTest { } } -} +} \ No newline at end of file diff --git a/dubbo-configcenter/dubbo-configcenter-zookeeper/src/test/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfigurationTest.java b/dubbo-configcenter/dubbo-configcenter-zookeeper/src/test/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfigurationTest.java index b5faadbd40..99e7674ba1 100644 --- a/dubbo-configcenter/dubbo-configcenter-zookeeper/src/test/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfigurationTest.java +++ b/dubbo-configcenter/dubbo-configcenter-zookeeper/src/test/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfigurationTest.java @@ -45,7 +45,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * TODO refactor using mockito */ @Disabled("Disabled Due to Zookeeper in Github Actions") -public class ZookeeperDynamicConfigurationTest { +class ZookeeperDynamicConfigurationTest { private static CuratorFramework client; private static URL configUrl; @@ -98,12 +98,12 @@ public class ZookeeperDynamicConfigurationTest { } @Test - public void testGetConfig() { + void testGetConfig() { Assertions.assertEquals("The content from dubbo.properties", configuration.getConfig("dubbo.properties", "dubbo")); } @Test - public void testAddListener() throws Exception { + void testAddListener() throws Exception { CountDownLatch latch = new CountDownLatch(4); String[] value1 = new String[1], value2 = new String[1], value3 = new String[1], value4 = new String[1]; @@ -141,7 +141,7 @@ public class ZookeeperDynamicConfigurationTest { } @Test - public void testPublishConfig() { + void testPublishConfig() { String key = "user-service"; String group = "org.apache.dubbo.service.UserService"; String content = "test"; @@ -151,7 +151,7 @@ public class ZookeeperDynamicConfigurationTest { } @Test - public void testPublishConfigCas() { + void testPublishConfigCas() { String key = "user-service-cas"; String group = "org.apache.dubbo.service.UserService"; String content = "test"; @@ -181,4 +181,4 @@ public class ZookeeperDynamicConfigurationTest { // assertEquals(new TreeSet(asList(key, key2)), configKeys); // } -} +} \ No newline at end of file diff --git a/dubbo-container/dubbo-container-spring/src/test/java/org/apache/dubbo/container/spring/SpringContainerTest.java b/dubbo-container/dubbo-container-spring/src/test/java/org/apache/dubbo/container/spring/SpringContainerTest.java index a09a1bf349..9673770c84 100644 --- a/dubbo-container/dubbo-container-spring/src/test/java/org/apache/dubbo/container/spring/SpringContainerTest.java +++ b/dubbo-container/dubbo-container-spring/src/test/java/org/apache/dubbo/container/spring/SpringContainerTest.java @@ -25,14 +25,14 @@ import org.junit.jupiter.api.Test; /** * StandaloneContainerTest */ -public class SpringContainerTest { +class SpringContainerTest { @Test - public void testContainer() { + void testContainer() { SpringContainer container = (SpringContainer) ExtensionLoader.getExtensionLoader(Container.class).getExtension("spring"); container.start(); Assertions.assertEquals(SpringContainer.class, container.context.getBean("container").getClass()); container.stop(); } -} +} \ No newline at end of file diff --git a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/filter/CacheFilterTest.java b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/filter/CacheFilterTest.java index df49f6d4f5..f420f3fa04 100644 --- a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/filter/CacheFilterTest.java +++ b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/filter/CacheFilterTest.java @@ -37,7 +37,7 @@ import java.util.stream.Stream; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -public class CacheFilterTest { +class CacheFilterTest { private RpcInvocation invocation; private CacheFilter cacheFilter = new CacheFilter(); private Invoker invoker = mock(Invoker.class); @@ -138,4 +138,4 @@ public class CacheFilterTest { Assertions.assertNull(result1.getValue()); Assertions.assertNull(result2.getValue()); } -} +} \ No newline at end of file diff --git a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/AbstractCacheFactoryTest.java b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/AbstractCacheFactoryTest.java index 8887bdd952..f93a453eeb 100644 --- a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/AbstractCacheFactoryTest.java +++ b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/AbstractCacheFactoryTest.java @@ -30,4 +30,4 @@ public abstract class AbstractCacheFactoryTest { } protected abstract AbstractCacheFactory getCacheFactory(); -} +} \ No newline at end of file diff --git a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/expiring/ExpiringCacheFactoryTest.java b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/expiring/ExpiringCacheFactoryTest.java index 8ceac15220..bedb6a9d2a 100644 --- a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/expiring/ExpiringCacheFactoryTest.java +++ b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/expiring/ExpiringCacheFactoryTest.java @@ -32,19 +32,19 @@ import static org.hamcrest.core.Is.is; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; -public class ExpiringCacheFactoryTest extends AbstractCacheFactoryTest { +class ExpiringCacheFactoryTest extends AbstractCacheFactoryTest { private static final String EXPIRING_CACHE_URL = "test://test:12/test?cache=expiring&cache.seconds=1&cache.interval=1"; @Test - public void testExpiringCacheFactory() throws Exception { + void testExpiringCacheFactory() throws Exception { Cache cache = super.constructCache(); assertThat(cache instanceof ExpiringCache, is(true)); } @Test - public void testExpiringCacheGetExpired() throws Exception { + void testExpiringCacheGetExpired() throws Exception { URL url = URL.valueOf("test://test:12/test?cache=expiring&cache.seconds=1&cache.interval=1"); AbstractCacheFactory cacheFactory = getCacheFactory(); Invocation invocation = new RpcInvocation(); @@ -55,7 +55,7 @@ public class ExpiringCacheFactoryTest extends AbstractCacheFactoryTest { } @Test - public void testExpiringCacheUnExpired() throws Exception { + void testExpiringCacheUnExpired() throws Exception { URL url = URL.valueOf("test://test:12/test?cache=expiring&cache.seconds=0&cache.interval=1"); AbstractCacheFactory cacheFactory = getCacheFactory(); Invocation invocation = new RpcInvocation(); @@ -66,7 +66,7 @@ public class ExpiringCacheFactoryTest extends AbstractCacheFactoryTest { } @Test - public void testExpiringCache() throws Exception { + void testExpiringCache() throws Exception { Cache cache = constructCache(); assertThat(cache instanceof ExpiringCache, is(true)); @@ -82,7 +82,7 @@ public class ExpiringCacheFactoryTest extends AbstractCacheFactoryTest { } @Test - public void testExpiringCacheExpired() throws Exception { + void testExpiringCacheExpired() throws Exception { Cache cache = constructCache(); assertThat(cache instanceof ExpiringCache, is(true)); @@ -107,4 +107,4 @@ public class ExpiringCacheFactoryTest extends AbstractCacheFactoryTest { protected AbstractCacheFactory getCacheFactory() { return new ExpiringCacheFactory(); } -} +} \ No newline at end of file diff --git a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/jcache/JCacheFactoryTest.java b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/jcache/JCacheFactoryTest.java index 0250bc8192..c4412ae9cd 100644 --- a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/jcache/JCacheFactoryTest.java +++ b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/jcache/JCacheFactoryTest.java @@ -29,16 +29,16 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.jupiter.api.Assertions.assertNull; -public class JCacheFactoryTest extends AbstractCacheFactoryTest { +class JCacheFactoryTest extends AbstractCacheFactoryTest { @Test - public void testJCacheFactory() throws Exception { + void testJCacheFactory() throws Exception { Cache cache = super.constructCache(); assertThat(cache instanceof JCache, is(true)); } @Test - public void testJCacheGetExpired() throws Exception { + void testJCacheGetExpired() throws Exception { URL url = URL.valueOf("test://test:12/test?cache=jacache&cache.write.expire=1"); AbstractCacheFactory cacheFactory = getCacheFactory(); Invocation invocation = new RpcInvocation(); @@ -52,4 +52,4 @@ public class JCacheFactoryTest extends AbstractCacheFactoryTest { protected AbstractCacheFactory getCacheFactory() { return new JCacheFactory(); } -} +} \ No newline at end of file diff --git a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/lru/LruCacheFactoryTest.java b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/lru/LruCacheFactoryTest.java index 132d65af39..131defdd41 100644 --- a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/lru/LruCacheFactoryTest.java +++ b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/lru/LruCacheFactoryTest.java @@ -25,9 +25,9 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -public class LruCacheFactoryTest extends AbstractCacheFactoryTest{ +class LruCacheFactoryTest extends AbstractCacheFactoryTest{ @Test - public void testLruCacheFactory() throws Exception { + void testLruCacheFactory() throws Exception { Cache cache = super.constructCache(); assertThat(cache instanceof LruCache, is(true)); } @@ -36,4 +36,4 @@ public class LruCacheFactoryTest extends AbstractCacheFactoryTest{ protected AbstractCacheFactory getCacheFactory() { return new LruCacheFactory(); } -} +} \ No newline at end of file diff --git a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/threadlocal/ThreadLocalCacheFactoryTest.java b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/threadlocal/ThreadLocalCacheFactoryTest.java index aa576685d8..31184ec142 100644 --- a/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/threadlocal/ThreadLocalCacheFactoryTest.java +++ b/dubbo-filter/dubbo-filter-cache/src/test/java/org/apache/dubbo/cache/support/threadlocal/ThreadLocalCacheFactoryTest.java @@ -25,9 +25,9 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -public class ThreadLocalCacheFactoryTest extends AbstractCacheFactoryTest { +class ThreadLocalCacheFactoryTest extends AbstractCacheFactoryTest { @Test - public void testThreadLocalCacheFactory() throws Exception { + void testThreadLocalCacheFactory() throws Exception { Cache cache = super.constructCache(); assertThat(cache instanceof ThreadLocalCache, is(true)); } @@ -36,4 +36,4 @@ public class ThreadLocalCacheFactoryTest extends AbstractCacheFactoryTest { protected AbstractCacheFactory getCacheFactory() { return new ThreadLocalCacheFactory(); } -} +} \ No newline at end of file diff --git a/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/filter/ValidationFilterTest.java b/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/filter/ValidationFilterTest.java index 4f21514f26..dde1cf38c1 100644 --- a/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/filter/ValidationFilterTest.java +++ b/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/filter/ValidationFilterTest.java @@ -34,7 +34,7 @@ import static org.hamcrest.core.Is.is; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -public class ValidationFilterTest { +class ValidationFilterTest { private Invoker invoker = mock(Invoker.class); private Validation validation = mock(Validation.class); private Validator validator = mock(Validator.class); @@ -48,7 +48,7 @@ public class ValidationFilterTest { } @Test - public void testItWithNotExistClass() throws Exception { + void testItWithNotExistClass() throws Exception { URL url = URL.valueOf("test://test:11/test?validation=true"); given(validation.getValidator(url)).willThrow(new IllegalStateException("Not found class test, cause: test")); @@ -66,7 +66,7 @@ public class ValidationFilterTest { } @Test - public void testItWithExistClass() throws Exception { + void testItWithExistClass() throws Exception { URL url = URL.valueOf("test://test:11/test?validation=true"); given(validation.getValidator(url)).willReturn(validator); @@ -83,7 +83,7 @@ public class ValidationFilterTest { } @Test - public void testItWithoutUrlParameters() throws Exception { + void testItWithoutUrlParameters() throws Exception { URL url = URL.valueOf("test://test:11/test"); given(validation.getValidator(url)).willReturn(validator); @@ -100,7 +100,7 @@ public class ValidationFilterTest { } @Test - public void testItWhileMethodNameStartWithDollar() throws Exception { + void testItWhileMethodNameStartWithDollar() throws Exception { URL url = URL.valueOf("test://test:11/test"); given(validation.getValidator(url)).willReturn(validator); @@ -119,7 +119,7 @@ public class ValidationFilterTest { @Test - public void testItWhileThrowoutRpcException() throws Exception { + void testItWhileThrowoutRpcException() throws Exception { Assertions.assertThrows(RpcException.class, () -> { URL url = URL.valueOf("test://test:11/test?validation=true"); @@ -134,4 +134,4 @@ public class ValidationFilterTest { validationFilter.invoke(invoker, invocation); }); } -} +} \ No newline at end of file diff --git a/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/JValidationTest.java b/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/JValidationTest.java index 80b1d07aa6..c016cbbf27 100644 --- a/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/JValidationTest.java +++ b/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/JValidationTest.java @@ -28,9 +28,9 @@ import javax.validation.ValidationException; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -public class JValidationTest { +class JValidationTest { @Test - public void testReturnTypeWithInvalidValidationProvider() { + void testReturnTypeWithInvalidValidationProvider() { Assertions.assertThrows(ValidationException.class, () -> { Validation jValidation = new JValidation(); URL url = URL.valueOf("test://test:11/org.apache.dubbo.validation.support.jvalidation.JValidation?" + @@ -41,10 +41,10 @@ public class JValidationTest { } @Test - public void testReturnTypeWithDefaultValidatorProvider() { + void testReturnTypeWithDefaultValidatorProvider() { Validation jValidation = new JValidation(); URL url = URL.valueOf("test://test:11/org.apache.dubbo.validation.support.jvalidation.JValidation"); Validator validator = jValidation.getValidator(url); assertThat(validator instanceof JValidator, is(true)); } -} +} \ No newline at end of file diff --git a/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/JValidatorTest.java b/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/JValidatorTest.java index 4e76769e4b..38298eeb6d 100644 --- a/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/JValidatorTest.java +++ b/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/JValidatorTest.java @@ -28,9 +28,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class JValidatorTest { +class JValidatorTest { @Test - public void testItWithNonExistMethod() throws Exception { + void testItWithNonExistMethod() throws Exception { Assertions.assertThrows(NoSuchMethodException.class, () -> { URL url = URL.valueOf("test://test:11/org.apache.dubbo.validation.support.jvalidation.mock.JValidatorTestTarget"); JValidator jValidator = new JValidator(url); @@ -39,14 +39,14 @@ public class JValidatorTest { } @Test - public void testItWithExistMethod() throws Exception { + void testItWithExistMethod() throws Exception { URL url = URL.valueOf("test://test:11/org.apache.dubbo.validation.support.jvalidation.mock.JValidatorTestTarget"); JValidator jValidator = new JValidator(url); jValidator.validate("someMethod1", new Class[]{String.class}, new Object[]{"anything"}); } @Test - public void testItWhenItViolatedConstraint() throws Exception { + void testItWhenItViolatedConstraint() throws Exception { Assertions.assertThrows(ValidationException.class, () -> { URL url = URL.valueOf("test://test:11/org.apache.dubbo.validation.support.jvalidation.mock.JValidatorTestTarget"); JValidator jValidator = new JValidator(url); @@ -55,32 +55,32 @@ public class JValidatorTest { } @Test - public void testItWhenItMeetsConstraint() throws Exception { + void testItWhenItMeetsConstraint() throws Exception { URL url = URL.valueOf("test://test:11/org.apache.dubbo.validation.support.jvalidation.mock.JValidatorTestTarget"); JValidator jValidator = new JValidator(url); jValidator.validate("someMethod2", new Class[]{ValidationParameter.class}, new Object[]{new ValidationParameter("NotBeNull")}); } @Test - public void testItWithArrayArg() throws Exception { + void testItWithArrayArg() throws Exception { URL url = URL.valueOf("test://test:11/org.apache.dubbo.validation.support.jvalidation.mock.JValidatorTestTarget"); JValidator jValidator = new JValidator(url); jValidator.validate("someMethod3", new Class[]{ValidationParameter[].class}, new Object[]{new ValidationParameter[]{new ValidationParameter("parameter")}}); } @Test - public void testItWithCollectionArg() throws Exception { + void testItWithCollectionArg() throws Exception { URL url = URL.valueOf("test://test:11/org.apache.dubbo.validation.support.jvalidation.mock.JValidatorTestTarget"); JValidator jValidator = new JValidator(url); jValidator.validate("someMethod4", new Class[]{List.class}, new Object[]{Arrays.asList("parameter")}); } @Test - public void testItWithMapArg() throws Exception { + void testItWithMapArg() throws Exception { URL url = URL.valueOf("test://test:11/org.apache.dubbo.validation.support.jvalidation.mock.JValidatorTestTarget"); JValidator jValidator = new JValidator(url); Map map = new HashMap<>(); map.put("key", "value"); jValidator.validate("someMethod5", new Class[]{Map.class}, new Object[]{map}); } -} +} \ No newline at end of file diff --git a/dubbo-kubernetes/src/test/java/org/apache/dubbo/registry/kubernetes/KubernetesServiceDiscoveryTest.java b/dubbo-kubernetes/src/test/java/org/apache/dubbo/registry/kubernetes/KubernetesServiceDiscoveryTest.java index 28aa0027c4..16473cd46a 100644 --- a/dubbo-kubernetes/src/test/java/org/apache/dubbo/registry/kubernetes/KubernetesServiceDiscoveryTest.java +++ b/dubbo-kubernetes/src/test/java/org/apache/dubbo/registry/kubernetes/KubernetesServiceDiscoveryTest.java @@ -51,7 +51,7 @@ import java.util.Map; import static org.apache.dubbo.registry.kubernetes.util.KubernetesClientConst.NAMESPACE; @ExtendWith({MockitoExtension.class}) -public class KubernetesServiceDiscoveryTest { +class KubernetesServiceDiscoveryTest { private static final String SERVICE_NAME = "TestService"; private static final String POD_NAME = "TestServer"; @@ -120,7 +120,7 @@ public class KubernetesServiceDiscoveryTest { } @Test - public void testEndpointsUpdate() throws Exception { + void testEndpointsUpdate() throws Exception { serviceDiscovery.setCurrentHostname(POD_NAME); serviceDiscovery.setKubernetesClient(mockClient); @@ -154,7 +154,7 @@ public class KubernetesServiceDiscoveryTest { } @Test - public void testPodsUpdate() throws Exception { + void testPodsUpdate() throws Exception { serviceDiscovery.setCurrentHostname(POD_NAME); serviceDiscovery.setKubernetesClient(mockClient); @@ -182,7 +182,7 @@ public class KubernetesServiceDiscoveryTest { } @Test - public void testServiceUpdate() throws Exception { + void testServiceUpdate() throws Exception { serviceDiscovery.setCurrentHostname(POD_NAME); serviceDiscovery.setKubernetesClient(mockClient); @@ -215,7 +215,7 @@ public class KubernetesServiceDiscoveryTest { } @Test - public void testGetInstance() { + void testGetInstance() { serviceDiscovery.setCurrentHostname(POD_NAME); serviceDiscovery.setKubernetesClient(mockClient); @@ -230,4 +230,4 @@ public class KubernetesServiceDiscoveryTest { serviceDiscovery.doUnregister(serviceInstance); } -} +} \ No newline at end of file diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/AbstractServiceNameMappingTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/AbstractServiceNameMappingTest.java index 8bab6f4c2e..e2906dd7a5 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/AbstractServiceNameMappingTest.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/AbstractServiceNameMappingTest.java @@ -70,7 +70,7 @@ class AbstractServiceNameMappingTest { } @Test - public void testGetAndListener() { + void testGetAndListener() { URL registryURL = URL.valueOf("registry://127.0.0.1:7777/test"); registryURL = registryURL.addParameter(SUBSCRIBED_SERVICE_NAMES_KEY, "registry-app1"); diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/MetadataInfoTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/MetadataInfoTest.java index ccd91deb05..544aaa5721 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/MetadataInfoTest.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/MetadataInfoTest.java @@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * Some construction and filter cases are covered in InMemoryMetadataServiceTest */ -public class MetadataInfoTest { +class MetadataInfoTest { private static URL url = URL.valueOf("dubbo://30.225.21.30:20880/org.apache.dubbo.registry.service.DemoService2?" + "REGISTRY_CLUSTER=registry1&anyhost=true&application=demo-provider2&delay=5000&deprecated=false&dubbo=2.0.2" + "&dynamic=true&generic=false&group=greeting&interface=org.apache.dubbo.registry.service.DemoService2" + @@ -67,7 +67,7 @@ public class MetadataInfoTest { "&side=provider&timeout=5000×tamp=1629970068002&version=1.0.0¶ms-filter=-customized,excluded"); @Test - public void testEmptyRevision() { + void testEmptyRevision() { MetadataInfo metadataInfo = new MetadataInfo("demo"); metadataInfo.setApp("demo"); @@ -75,7 +75,7 @@ public class MetadataInfoTest { } @Test - public void testParamsFilterIncluded() { + void testParamsFilterIncluded() { MetadataInfo metadataInfo = new MetadataInfo("demo"); // export normal url again @@ -93,7 +93,7 @@ public class MetadataInfoTest { } @Test - public void testParamsFilterExcluded() { + void testParamsFilterExcluded() { MetadataInfo metadataInfo = new MetadataInfo("demo"); // export normal url again @@ -111,7 +111,7 @@ public class MetadataInfoTest { } @Test - public void testEqualsAndRevision() { + void testEqualsAndRevision() { // same metadata MetadataInfo metadataInfo = new MetadataInfo("demo"); metadataInfo.addService(url); @@ -144,7 +144,7 @@ public class MetadataInfoTest { } @Test - public void testChanged() { + void testChanged() { MetadataInfo metadataInfo = new MetadataInfo("demo"); metadataInfo.addService(url); metadataInfo.addService(url2); @@ -156,7 +156,7 @@ public class MetadataInfoTest { } @Test - public void testJsonFormat() { + void testJsonFormat() { MetadataInfo metadataInfo = new MetadataInfo("demo"); // export normal url again @@ -172,7 +172,7 @@ public class MetadataInfoTest { } @Test - public void testJdkSerialize() throws IOException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException { + void testJdkSerialize() throws IOException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); MetadataInfo metadataInfo = new MetadataInfo("demo"); @@ -195,7 +195,7 @@ public class MetadataInfoTest { } @Test - public void testCal() { + void testCal() { MetadataInfo metadataInfo = new MetadataInfo("demo"); // export normal url again diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/ServiceNameMappingTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/ServiceNameMappingTest.java index 7a03cd49e0..322359fa00 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/ServiceNameMappingTest.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/ServiceNameMappingTest.java @@ -42,12 +42,12 @@ import static org.junit.jupiter.api.Assertions.assertThrows; */ /** - * {@link ServiceNameMapping} Test + * {@link org.apache.dubbo.metadata.ServiceNameMapping} Test * * @since 2.7.8 *//* -public class ServiceNameMappingTest { +class ServiceNameMappingTest { private static final URL BASE_URL = URL.valueOf("dubbo://127.0.0.1:20880"); @@ -83,7 +83,7 @@ public class ServiceNameMappingTest { } @Test - public void testDeprecatedMethods() { + void testDeprecatedMethods() { assertThrows(UnsupportedOperationException.class, () -> { serviceNameMapping.map(null, null, null, null); }); @@ -94,7 +94,7 @@ public class ServiceNameMappingTest { } @Test - public void testMap() { + void testMap() { String serviceInterface = ServiceNameMapping.class.getName(); String key = applicationName; String group = buildGroup(serviceInterface, null, null, null); @@ -104,7 +104,7 @@ public class ServiceNameMappingTest { } @Test - public void testGet() { + void testGet() { String serviceInterface = ServiceNameMapping.class.getName(); URL url = BASE_URL.setServiceInterface(serviceInterface); serviceNameMapping.map(url); diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/MetadataReportInstanceTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/MetadataReportInstanceTest.java index 1e8f7e6c4a..0f2d3cb4b6 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/MetadataReportInstanceTest.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/MetadataReportInstanceTest.java @@ -27,7 +27,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.Collections; import java.util.Map; @@ -68,7 +67,7 @@ class MetadataReportInstanceTest { } @Test - public void test() { + void test() { Assertions.assertNull(metadataReportInstance.getMetadataReport(registryId), "the metadata report was not initialized."); assertThat(metadataReportInstance.getMetadataReports(true), Matchers.anEmptyMap()); diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/KeyTypeEnumTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/KeyTypeEnumTest.java index c4dae1f919..fe9a8274c8 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/KeyTypeEnumTest.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/KeyTypeEnumTest.java @@ -25,13 +25,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * * @since 2.7.8 */ -public class KeyTypeEnumTest { +class KeyTypeEnumTest { /** * {@link KeyTypeEnum#build(String, String...)} */ @Test - public void testBuild() { + void testBuild() { assertEquals("/A/B/C", KeyTypeEnum.PATH.build("/A", "/B", "C")); assertEquals("A:B:C", KeyTypeEnum.UNIQUE_KEY.build("A", "B", "C")); } diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifierTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifierTest.java index 3a58933e16..810c668a62 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifierTest.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifierTest.java @@ -27,10 +27,10 @@ import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE; /** * 2019/1/7 */ -public class MetadataIdentifierTest { +class MetadataIdentifierTest { @Test - public void testGetUniqueKey() { + void testGetUniqueKey() { String interfaceName = "org.apache.dubbo.metadata.integration.InterfaceNameTestService"; String version = "1.0.0.zk.md"; String group = null; diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java index 99e5cb114b..56cd80e778 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java @@ -37,7 +37,7 @@ import java.util.concurrent.ConcurrentHashMap; /** * 2018/9/14 */ -public class AbstractMetadataReportFactoryTest { +class AbstractMetadataReportFactoryTest { private AbstractMetadataReportFactory metadataReportFactory = new AbstractMetadataReportFactory() { @Override @@ -112,7 +112,7 @@ public class AbstractMetadataReportFactoryTest { }; @Test - public void testGetOneMetadataReport() { + void testGetOneMetadataReport() { URL url = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic"); MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url); MetadataReport metadataReport2 = metadataReportFactory.getMetadataReport(url); @@ -120,7 +120,7 @@ public class AbstractMetadataReportFactoryTest { } @Test - public void testGetOneMetadataReportForIpFormat() { + void testGetOneMetadataReportForIpFormat() { String hostName = NetUtils.getLocalAddress().getHostName(); String ip = NetUtils.getIpByHost(hostName); URL url1 = URL.valueOf("zookeeper://" + hostName + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic"); @@ -131,7 +131,7 @@ public class AbstractMetadataReportFactoryTest { } @Test - public void testGetForDiffService() { + void testGetForDiffService() { URL url1 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService1?version=1.0.0&application=vic"); URL url2 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService2?version=1.0.0&application=vic"); MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url1); @@ -140,7 +140,7 @@ public class AbstractMetadataReportFactoryTest { } @Test - public void testGetForDiffGroup() { + void testGetForDiffGroup() { URL url1 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic&group=aaa"); URL url2 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic&group=bbb"); MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url1); diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportTest.java index 99a0c44178..50ecefe1a3 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportTest.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportTest.java @@ -48,7 +48,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class AbstractMetadataReportTest { +class AbstractMetadataReportTest { private NewMetadataReport abstractMetadataReport; @@ -67,7 +67,7 @@ public class AbstractMetadataReportTest { } @Test - public void testGetProtocol() { + void testGetProtocol() { URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic&side=provider"); String protocol = abstractMetadataReport.getProtocol(url); assertEquals(protocol, "provider"); @@ -78,7 +78,7 @@ public class AbstractMetadataReportTest { } @Test - public void testStoreProviderUsual() throws ClassNotFoundException, InterruptedException { + void testStoreProviderUsual() throws ClassNotFoundException, InterruptedException { String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService"; String version = "1.0.0"; String group = null; @@ -89,7 +89,7 @@ public class AbstractMetadataReportTest { } @Test - public void testStoreProviderSync() throws ClassNotFoundException, InterruptedException { + void testStoreProviderSync() throws ClassNotFoundException, InterruptedException { String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService"; String version = "1.0.0"; String group = null; @@ -100,7 +100,7 @@ public class AbstractMetadataReportTest { } @Test - public void testFileExistAfterPut() throws InterruptedException, ClassNotFoundException { + void testFileExistAfterPut() throws InterruptedException, ClassNotFoundException { //just for one method URL singleUrl = URL.valueOf("redis://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.metadata.store.InterfaceNameTestService?version=1.0.0&application=singleTest"); NewMetadataReport singleMetadataReport = new NewMetadataReport(singleUrl); @@ -119,7 +119,7 @@ public class AbstractMetadataReportTest { } @Test - public void testRetry() throws InterruptedException, ClassNotFoundException { + void testRetry() throws InterruptedException, ClassNotFoundException { String interfaceName = "org.apache.dubbo.metadata.store.RetryTestService"; String version = "1.0.0.retry"; String group = null; @@ -148,7 +148,7 @@ public class AbstractMetadataReportTest { } @Test - public void testRetryCancel() throws InterruptedException, ClassNotFoundException { + void testRetryCancel() throws InterruptedException, ClassNotFoundException { String interfaceName = "org.apache.dubbo.metadata.store.RetryTestService"; String version = "1.0.0.retrycancel"; String group = null; @@ -197,7 +197,7 @@ public class AbstractMetadataReportTest { } @Test - public void testPublishAll() throws ClassNotFoundException, InterruptedException { + void testPublishAll() throws ClassNotFoundException, InterruptedException { assertTrue(abstractMetadataReport.store.isEmpty()); assertTrue(abstractMetadataReport.allMetadataReports.isEmpty()); @@ -250,7 +250,7 @@ public class AbstractMetadataReportTest { } @Test - public void testCalculateStartTime() { + void testCalculateStartTime() { for (int i = 0; i < 300; i++) { long t = abstractMetadataReport.calculateStartTime() + System.currentTimeMillis(); Calendar c = Calendar.getInstance(); diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/jaxrs/JAXRSServiceRestMetadataResolverTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/jaxrs/JAXRSServiceRestMetadataResolverTest.java index 1ebaf3a86a..1e1acb1cf3 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/jaxrs/JAXRSServiceRestMetadataResolverTest.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/jaxrs/JAXRSServiceRestMetadataResolverTest.java @@ -37,12 +37,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class JAXRSServiceRestMetadataResolverTest { +class JAXRSServiceRestMetadataResolverTest { private JAXRSServiceRestMetadataResolver instance = new JAXRSServiceRestMetadataResolver(); @Test - public void testSupports() { + void testSupports() { // JAX-RS RestService class assertTrue(instance.supports(StandardRestService.class)); // Spring MVC RestService class @@ -56,7 +56,7 @@ public class JAXRSServiceRestMetadataResolverTest { } @Test - public void testResolve() { + void testResolve() { // Generated by "dubbo-metadata-processor" ClassPathServiceRestMetadataReader reader = new ClassPathServiceRestMetadataReader("META-INF/dubbo/jax-rs-service-rest-metadata.json"); List serviceRestMetadataList = reader.read(); diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/springmvc/SpringMvcServiceRestMetadataResolverTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/springmvc/SpringMvcServiceRestMetadataResolverTest.java index 4fd0e1a164..e7d0ba42ca 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/springmvc/SpringMvcServiceRestMetadataResolverTest.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/springmvc/SpringMvcServiceRestMetadataResolverTest.java @@ -37,12 +37,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.9 */ -public class SpringMvcServiceRestMetadataResolverTest { +class SpringMvcServiceRestMetadataResolverTest { private SpringMvcServiceRestMetadataResolver instance = new SpringMvcServiceRestMetadataResolver(); @Test - public void testSupports() { + void testSupports() { // Spring MVC RestService class assertTrue(instance.supports(SpringRestService.class)); // JAX-RS RestService class @@ -56,7 +56,7 @@ public class SpringMvcServiceRestMetadataResolverTest { } @Test - public void testResolve() { + void testResolve() { // Generated by "dubbo-metadata-processor" ClassPathServiceRestMetadataReader reader = new ClassPathServiceRestMetadataReader("META-INF/dubbo/spring-mvc-service-rest-metadata.json"); List serviceRestMetadataList = reader.read(); diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/test/JTestMetadataReport4Test.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/test/JTestMetadataReport4Test.java index 8e94495126..ad4f052954 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/test/JTestMetadataReport4Test.java +++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/test/JTestMetadataReport4Test.java @@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentHashMap; /** * ZookeeperRegistry */ -public class JTestMetadataReport4Test extends AbstractMetadataReport { +class JTestMetadataReport4Test extends AbstractMetadataReport { private final static Logger logger = LoggerFactory.getLogger(JTestMetadataReport4Test.class); diff --git a/dubbo-metadata/dubbo-metadata-definition-protobuf/src/test/java/org/apache/dubbo/metadata/definition/protobuf/ProtobufTypeBuilderTest.java b/dubbo-metadata/dubbo-metadata-definition-protobuf/src/test/java/org/apache/dubbo/metadata/definition/protobuf/ProtobufTypeBuilderTest.java index 426fe0cb73..559d313f46 100644 --- a/dubbo-metadata/dubbo-metadata-definition-protobuf/src/test/java/org/apache/dubbo/metadata/definition/protobuf/ProtobufTypeBuilderTest.java +++ b/dubbo-metadata/dubbo-metadata-definition-protobuf/src/test/java/org/apache/dubbo/metadata/definition/protobuf/ProtobufTypeBuilderTest.java @@ -36,9 +36,9 @@ import static org.hamcrest.MatcherAssert.assertThat; /** * 2019-07-01 */ -public class ProtobufTypeBuilderTest { +class ProtobufTypeBuilderTest { @Test - public void testProtobufBuilder() { + void testProtobufBuilder() { TypeDefinitionBuilder.initBuilders(FrameworkModel.defaultModel()); // TEST Pb Service metaData builder diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ArrayTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ArrayTypeDefinitionBuilderTest.java index d3e7ff1190..cd84396e6d 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ArrayTypeDefinitionBuilderTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ArrayTypeDefinitionBuilderTest.java @@ -41,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class ArrayTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { +class ArrayTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { private ArrayTypeDefinitionBuilder builder; @@ -74,7 +74,7 @@ public class ArrayTypeDefinitionBuilderTest extends AbstractAnnotationProcessing } @Test - public void testAccept() { + void testAccept() { assertTrue(builder.accept(processingEnv, integersField.asType())); assertTrue(builder.accept(processingEnv, stringsField.asType())); assertTrue(builder.accept(processingEnv, primitiveTypeModelsField.asType())); @@ -83,7 +83,7 @@ public class ArrayTypeDefinitionBuilderTest extends AbstractAnnotationProcessing } @Test - public void testBuild() { + void testBuild() { buildAndAssertTypeDefinition(processingEnv, integersField, "int[]", "int", builder); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/CollectionTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/CollectionTypeDefinitionBuilderTest.java index bd6e7a4e04..e99d417784 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/CollectionTypeDefinitionBuilderTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/CollectionTypeDefinitionBuilderTest.java @@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class CollectionTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { +class CollectionTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { private CollectionTypeDefinitionBuilder builder; @@ -72,7 +72,7 @@ public class CollectionTypeDefinitionBuilderTest extends AbstractAnnotationProce } @Test - public void testAccept() { + void testAccept() { assertTrue(builder.accept(processingEnv, stringsField.asType())); assertTrue(builder.accept(processingEnv, colorsField.asType())); assertTrue(builder.accept(processingEnv, primitiveTypeModelsField.asType())); @@ -81,7 +81,7 @@ public class CollectionTypeDefinitionBuilderTest extends AbstractAnnotationProce } @Test - public void testBuild() { + void testBuild() { buildAndAssertTypeDefinition(processingEnv, stringsField, "java.util.Collection", "java.lang.String", builder); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/EnumTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/EnumTypeDefinitionBuilderTest.java index aaea5df876..49572e708e 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/EnumTypeDefinitionBuilderTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/EnumTypeDefinitionBuilderTest.java @@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class EnumTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { +class EnumTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { private EnumTypeDefinitionBuilder builder; @@ -51,13 +51,13 @@ public class EnumTypeDefinitionBuilderTest extends AbstractAnnotationProcessingT } @Test - public void testAccept() { + void testAccept() { TypeElement typeElement = getType(Color.class); assertTrue(builder.accept(processingEnv, typeElement.asType())); } @Test - public void testBuild() { + void testBuild() { TypeElement typeElement = getType(Color.class); Map typeCache = new HashMap<>(); TypeDefinition typeDefinition = TypeDefinitionBuilder.build(processingEnv, typeElement, typeCache); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/GeneralTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/GeneralTypeDefinitionBuilderTest.java index 33e27d3176..8ca703aa32 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/GeneralTypeDefinitionBuilderTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/GeneralTypeDefinitionBuilderTest.java @@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class GeneralTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { +class GeneralTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { private GeneralTypeDefinitionBuilder builder; @@ -51,7 +51,7 @@ public class GeneralTypeDefinitionBuilderTest extends AbstractAnnotationProcessi } @Test - public void testAccept() { + void testAccept() { assertTrue(builder.accept(processingEnv, getType(Model.class).asType())); assertTrue(builder.accept(processingEnv, getType(PrimitiveTypeModel.class).asType())); assertTrue(builder.accept(processingEnv, getType(SimpleTypeModel.class).asType())); @@ -61,7 +61,7 @@ public class GeneralTypeDefinitionBuilderTest extends AbstractAnnotationProcessi } @Test - public void testBuild() { + void testBuild() { } } diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/MapTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/MapTypeDefinitionBuilderTest.java index a415277703..4f48684606 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/MapTypeDefinitionBuilderTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/MapTypeDefinitionBuilderTest.java @@ -40,7 +40,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class MapTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { +class MapTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { private MapTypeDefinitionBuilder builder; @@ -77,7 +77,7 @@ public class MapTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTe } @Test - public void testAccept() { + void testAccept() { assertTrue(builder.accept(processingEnv, stringsField.asType())); assertTrue(builder.accept(processingEnv, colorsField.asType())); assertTrue(builder.accept(processingEnv, primitiveTypeModelsField.asType())); @@ -86,7 +86,7 @@ public class MapTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTe } @Test - public void testBuild() { + void testBuild() { buildAndAssertTypeDefinition(processingEnv, stringsField, "java.util.Map", diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/PrimitiveTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/PrimitiveTypeDefinitionBuilderTest.java index c259ffc270..3c9774cf6c 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/PrimitiveTypeDefinitionBuilderTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/PrimitiveTypeDefinitionBuilderTest.java @@ -38,7 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class PrimitiveTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { +class PrimitiveTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { private PrimitiveTypeDefinitionBuilder builder; @@ -90,7 +90,7 @@ public class PrimitiveTypeDefinitionBuilderTest extends AbstractAnnotationProces } @Test - public void testAccept() { + void testAccept() { assertTrue(builder.accept(processingEnv, zField.asType())); assertTrue(builder.accept(processingEnv, bField.asType())); assertTrue(builder.accept(processingEnv, cField.asType())); @@ -102,7 +102,7 @@ public class PrimitiveTypeDefinitionBuilderTest extends AbstractAnnotationProces } @Test - public void testBuild() { + void testBuild() { buildAndAssertTypeDefinition(processingEnv, zField, builder); buildAndAssertTypeDefinition(processingEnv, bField, builder); buildAndAssertTypeDefinition(processingEnv, cField, builder); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ServiceDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ServiceDefinitionBuilderTest.java index a2477cc896..9906f12975 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ServiceDefinitionBuilderTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ServiceDefinitionBuilderTest.java @@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * * @since 2.7.6 */ -public class ServiceDefinitionBuilderTest extends AbstractAnnotationProcessingTest { +class ServiceDefinitionBuilderTest extends AbstractAnnotationProcessingTest { @Override @@ -48,7 +48,7 @@ public class ServiceDefinitionBuilderTest extends AbstractAnnotationProcessingTe } @Test - public void testBuild() { + void testBuild() { ServiceDefinition serviceDefinition = build(processingEnv, getType(TestServiceImpl.class)); assertEquals(TestServiceImpl.class.getTypeName(), serviceDefinition.getCanonicalName()); assertEquals("org/apache/dubbo/metadata/tools/TestServiceImpl.class", serviceDefinition.getCodeSource()); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/SimpleTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/SimpleTypeDefinitionBuilderTest.java index 97edf89655..08f008d394 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/SimpleTypeDefinitionBuilderTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/SimpleTypeDefinitionBuilderTest.java @@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class SimpleTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { +class SimpleTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest { private SimpleTypeDefinitionBuilder builder; @@ -110,7 +110,7 @@ public class SimpleTypeDefinitionBuilderTest extends AbstractAnnotationProcessin } @Test - public void testAccept() { + void testAccept() { assertTrue(builder.accept(processingEnv, vField.asType())); assertTrue(builder.accept(processingEnv, zField.asType())); assertTrue(builder.accept(processingEnv, cField.asType())); @@ -129,7 +129,7 @@ public class SimpleTypeDefinitionBuilderTest extends AbstractAnnotationProcessin } @Test - public void testBuild() { + void testBuild() { buildAndAssertTypeDefinition(processingEnv, vField, builder); buildAndAssertTypeDefinition(processingEnv, zField, builder); buildAndAssertTypeDefinition(processingEnv, cField, builder); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/rest/AnnotatedMethodParameterProcessorTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/rest/AnnotatedMethodParameterProcessorTest.java index 825906b2f6..6db0efb5b5 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/rest/AnnotatedMethodParameterProcessorTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/rest/AnnotatedMethodParameterProcessorTest.java @@ -51,7 +51,7 @@ public abstract class AnnotatedMethodParameterProcessorTest extends AbstractAnno protected abstract String getExpectedAnnotationType(); @Test - public void testGetAnnotationType() { + void testGetAnnotationType() { String expectedAnnotationType = getExpectedAnnotationType(); assertNull(processor.getAnnotationType()); assertEquals(expectedAnnotationType, processor.getAnnotationType()); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java index cbc3dc12d9..186b06bb4f 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java @@ -56,7 +56,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest { +class AnnotationUtilsTest extends AbstractAnnotationProcessingTest { private TypeElement testType; @@ -70,7 +70,7 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetAnnotation() { + void testGetAnnotation() { AnnotationMirror serviceAnnotation = getAnnotation(testType, Service.class); assertEquals("3.0.0", getAttribute(serviceAnnotation, "version")); assertEquals("test", getAttribute(serviceAnnotation, "group")); @@ -90,7 +90,7 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetAnnotations() { + void testGetAnnotations() { List annotations = getAnnotations(testType); Iterator iterator = annotations.iterator(); @@ -129,7 +129,7 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetAllAnnotations() { + void testGetAllAnnotations() { List annotations = getAllAnnotations(testType); assertEquals(5, annotations.size()); @@ -172,7 +172,7 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest { @Test - public void testFindAnnotation() { + void testFindAnnotation() { assertEquals("org.apache.dubbo.config.annotation.Service", findAnnotation(testType, Service.class).getAnnotationType().toString()); assertEquals("com.alibaba.dubbo.config.annotation.Service", findAnnotation(testType, com.alibaba.dubbo.config.annotation.Service.class).getAnnotationType().toString()); @@ -193,14 +193,14 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testFindMetaAnnotation() { + void testFindMetaAnnotation() { getAllDeclaredMethods(getType(TestService.class)).forEach(method -> { assertEquals("javax.ws.rs.HttpMethod", findMetaAnnotation(method, "javax.ws.rs.HttpMethod").getAnnotationType().toString()); }); } @Test - public void testGetAttribute() { + void testGetAttribute() { assertEquals("org.apache.dubbo.metadata.tools.TestService", getAttribute(findAnnotation(testType, Service.class), "interfaceName")); assertEquals("org.apache.dubbo.metadata.tools.TestService", getAttribute(findAnnotation(testType, Service.class).getElementValues(), "interfaceName")); assertEquals("/echo", getAttribute(findAnnotation(testType, Path.class), "value")); @@ -217,13 +217,13 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetValue() { + void testGetValue() { AnnotationMirror pathAnnotation = getAnnotation(getType(TestService.class), Path.class); assertEquals("/echo", getValue(pathAnnotation)); } @Test - public void testIsAnnotationPresent() { + void testIsAnnotationPresent() { assertTrue(isAnnotationPresent(testType, "org.apache.dubbo.config.annotation.Service")); assertTrue(isAnnotationPresent(testType, "com.alibaba.dubbo.config.annotation.Service")); assertTrue(isAnnotationPresent(testType, "javax.ws.rs.Path")); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/FieldUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/FieldUtilsTest.java index 3afc647843..74b69cc72d 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/FieldUtilsTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/FieldUtilsTest.java @@ -57,7 +57,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class FieldUtilsTest extends AbstractAnnotationProcessingTest { +class FieldUtilsTest extends AbstractAnnotationProcessingTest { private TypeElement testType; @@ -71,7 +71,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetDeclaredFields() { + void testGetDeclaredFields() { TypeElement type = getType(Model.class); List fields = getDeclaredFields(type); assertModelFields(fields); @@ -88,7 +88,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetAllDeclaredFields() { + void testGetAllDeclaredFields() { TypeElement type = getType(Model.class); List fields = getAllDeclaredFields(type); @@ -104,7 +104,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetDeclaredField() { + void testGetDeclaredField() { TypeElement type = getType(Model.class); testGetDeclaredField(type, "f", float.class); testGetDeclaredField(type, "d", double.class); @@ -124,7 +124,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testFindField() { + void testFindField() { TypeElement type = getType(Model.class); testFindField(type, "f", float.class); testFindField(type, "d", double.class); @@ -149,7 +149,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsEnumField() { + void testIsEnumField() { TypeElement type = getType(Color.class); VariableElement field = findField(type, "RED"); assertTrue(isEnumMemberField(field)); @@ -168,7 +168,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsNonStaticField() { + void testIsNonStaticField() { TypeElement type = getType(Model.class); assertTrue(isNonStaticField(findField(type, "f"))); @@ -177,7 +177,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsField() { + void testIsField() { TypeElement type = getType(Model.class); assertTrue(isField(findField(type, "f"))); assertTrue(isField(findField(type, "f"), PRIVATE)); @@ -191,7 +191,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetNonStaticFields() { + void testGetNonStaticFields() { TypeElement type = getType(Model.class); List fields = getNonStaticFields(type); @@ -205,7 +205,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetAllNonStaticFields() { + void testGetAllNonStaticFields() { TypeElement type = getType(Model.class); List fields = getAllNonStaticFields(type); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/LoggerUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/LoggerUtilsTest.java index 4a06b216b1..284ccb4231 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/LoggerUtilsTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/LoggerUtilsTest.java @@ -27,22 +27,22 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; * * @since 2.7.6 */ -public class LoggerUtilsTest { +class LoggerUtilsTest { @Test - public void testLogger() { + void testLogger() { assertNotNull(LoggerUtils.LOGGER); } @Test - public void testInfo() { + void testInfo() { info("Hello,World"); info("Hello,%s", "World"); info("%s,%s", "Hello", "World"); } @Test - public void testWarn() { + void testWarn() { warn("Hello,World"); warn("Hello,%s", "World"); warn("%s,%s", "Hello", "World"); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MemberUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MemberUtilsTest.java index e119f00377..59a1b4545a 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MemberUtilsTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MemberUtilsTest.java @@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class MemberUtilsTest extends AbstractAnnotationProcessingTest { +class MemberUtilsTest extends AbstractAnnotationProcessingTest { private TypeElement testType; @@ -61,13 +61,13 @@ public class MemberUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsPublicNonStatic() { + void testIsPublicNonStatic() { assertFalse(isPublicNonStatic(null)); methodsIn(getDeclaredMembers(testType.asType())).forEach(method -> assertTrue(isPublicNonStatic(method))); } @Test - public void testHasModifiers() { + void testHasModifiers() { assertFalse(hasModifiers(null)); List members = getAllDeclaredMembers(testType.asType()); List fields = fieldsIn(members); @@ -75,7 +75,7 @@ public class MemberUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testDeclaredMembers() { + void testDeclaredMembers() { TypeElement type = getType(Model.class); List members = getDeclaredMembers(type.asType()); List fields = fieldsIn(members); @@ -105,7 +105,7 @@ public class MemberUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testMatchParameterTypes() { + void testMatchParameterTypes() { ExecutableElement method = findMethod(testType, "echo", "java.lang.String"); assertTrue(matchParameterTypes(method.getParameters(), "java.lang.String")); assertFalse(matchParameterTypes(method.getParameters(), "java.lang.Object")); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MethodUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MethodUtilsTest.java index db36f40957..dca4090df5 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MethodUtilsTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MethodUtilsTest.java @@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class MethodUtilsTest extends AbstractAnnotationProcessingTest { +class MethodUtilsTest extends AbstractAnnotationProcessingTest { private TypeElement testType; @@ -61,7 +61,7 @@ public class MethodUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testDeclaredMethods() { + void testDeclaredMethods() { TypeElement type = getType(Model.class); List methods = getDeclaredMethods(type); assertEquals(12, methods.size()); @@ -79,13 +79,13 @@ public class MethodUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetAllDeclaredMethods() { + void testGetAllDeclaredMethods() { List methods = doGetAllDeclaredMethods(); assertEquals(14, methods.size()); } @Test - public void testGetPublicNonStaticMethods() { + void testGetPublicNonStaticMethods() { List methods = getPublicNonStaticMethods(testType, Object.class); assertEquals(14, methods.size()); @@ -94,19 +94,19 @@ public class MethodUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsMethod() { + void testIsMethod() { List methods = getPublicNonStaticMethods(testType, Object.class); assertEquals(14, methods.stream().map(MethodUtils::isMethod).count()); } @Test - public void testIsPublicNonStaticMethod() { + void testIsPublicNonStaticMethod() { List methods = getPublicNonStaticMethods(testType, Object.class); assertEquals(14, methods.stream().map(MethodUtils::isPublicNonStaticMethod).count()); } @Test - public void testFindMethod() { + void testFindMethod() { TypeElement type = getType(Model.class); // Test methods from java.lang.Object // Object#toString() @@ -161,7 +161,7 @@ public class MethodUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetOverrideMethod() { + void testGetOverrideMethod() { List methods = doGetAllDeclaredMethods(); ExecutableElement overrideMethod = getOverrideMethod(processingEnv, testType, methods.get(0)); @@ -174,21 +174,21 @@ public class MethodUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetMethodName() { + void testGetMethodName() { ExecutableElement method = findMethod(testType, "echo", "java.lang.String"); assertEquals("echo", getMethodName(method)); assertNull(getMethodName(null)); } @Test - public void testReturnType() { + void testReturnType() { ExecutableElement method = findMethod(testType, "echo", "java.lang.String"); assertEquals("java.lang.String", getReturnType(method)); assertNull(getReturnType(null)); } @Test - public void testMatchParameterTypes() { + void testMatchParameterTypes() { ExecutableElement method = findMethod(testType, "echo", "java.lang.String"); assertArrayEquals(new String[]{"java.lang.String"}, getMethodParameterTypes(method)); assertTrue(getMethodParameterTypes(null).length == 0); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/ServiceAnnotationUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/ServiceAnnotationUtilsTest.java index e0e95a45c9..1bca2bc027 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/ServiceAnnotationUtilsTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/ServiceAnnotationUtilsTest.java @@ -52,7 +52,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest { +class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest { @Override protected void addCompiledClasses(Set> classesToBeCompiled) { @@ -65,7 +65,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest } @Test - public void testConstants() { + void testConstants() { assertEquals("org.apache.dubbo.config.annotation.DubboService", DUBBO_SERVICE_ANNOTATION_TYPE); assertEquals("org.apache.dubbo.config.annotation.Service", SERVICE_ANNOTATION_TYPE); assertEquals("com.alibaba.dubbo.config.annotation.Service", LEGACY_SERVICE_ANNOTATION_TYPE); @@ -77,7 +77,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest } @Test - public void testIsServiceAnnotationPresent() { + void testIsServiceAnnotationPresent() { assertTrue(isServiceAnnotationPresent(getType(TestServiceImpl.class))); assertTrue(isServiceAnnotationPresent(getType(GenericTestService.class))); @@ -87,7 +87,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest } @Test - public void testGetAnnotation() { + void testGetAnnotation() { TypeElement type = getType(TestServiceImpl.class); assertEquals("org.apache.dubbo.config.annotation.Service", getAnnotation(type).getAnnotationType().toString()); @@ -101,7 +101,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest } @Test - public void testResolveServiceInterfaceName() { + void testResolveServiceInterfaceName() { TypeElement type = getType(TestServiceImpl.class); assertEquals("org.apache.dubbo.metadata.tools.TestService", resolveServiceInterfaceName(type, getAnnotation(type))); @@ -113,7 +113,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest } @Test - public void testGetVersion() { + void testGetVersion() { TypeElement type = getType(TestServiceImpl.class); assertEquals("3.0.0", getVersion(getAnnotation(type))); @@ -125,7 +125,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest } @Test - public void testGetGroup() { + void testGetGroup() { TypeElement type = getType(TestServiceImpl.class); assertEquals("test", getGroup(getAnnotation(type))); diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/TypeUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/TypeUtilsTest.java index fc5995b7f3..04e86e77ff 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/TypeUtilsTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/TypeUtilsTest.java @@ -82,7 +82,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * * @since 2.7.6 */ -public class TypeUtilsTest extends AbstractAnnotationProcessingTest { +class TypeUtilsTest extends AbstractAnnotationProcessingTest { private TypeElement testType; @@ -98,7 +98,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsSimpleType() { + void testIsSimpleType() { assertTrue(isSimpleType(getType(Void.class))); assertTrue(isSimpleType(getType(Boolean.class))); @@ -121,7 +121,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsSameType() { + void testIsSameType() { assertTrue(isSameType(getType(Void.class).asType(), "java.lang.Void")); assertFalse(isSameType(getType(String.class).asType(), "java.lang.Void")); @@ -133,7 +133,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsArrayType() { + void testIsArrayType() { TypeElement type = getType(ArrayTypeModel.class); assertTrue(isArrayType(findField(type.asType(), "integers").asType())); assertTrue(isArrayType(findField(type.asType(), "strings").asType())); @@ -146,7 +146,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsEnumType() { + void testIsEnumType() { TypeElement type = getType(Color.class); assertTrue(isEnumType(type.asType())); @@ -158,7 +158,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsClassType() { + void testIsClassType() { TypeElement type = getType(ArrayTypeModel.class); assertTrue(isClassType(type.asType())); @@ -170,7 +170,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsPrimitiveType() { + void testIsPrimitiveType() { TypeElement type = getType(PrimitiveTypeModel.class); getDeclaredFields(type.asType()) .stream() @@ -184,7 +184,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsInterfaceType() { + void testIsInterfaceType() { TypeElement type = getType(CharSequence.class); assertTrue(isInterfaceType(type)); assertTrue(isInterfaceType(type.asType())); @@ -198,7 +198,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsAnnotationType() { + void testIsAnnotationType() { TypeElement type = getType(Override.class); assertTrue(isAnnotationType(type)); @@ -213,7 +213,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetHierarchicalTypes() { + void testGetHierarchicalTypes() { Set hierarchicalTypes = getHierarchicalTypes(testType.asType(), true, true, true); Iterator iterator = hierarchicalTypes.iterator(); assertEquals(8, hierarchicalTypes.size()); @@ -288,7 +288,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { @Test - public void testGetInterfaces() { + void testGetInterfaces() { TypeElement type = getType(Model.class); List interfaces = getInterfaces(type); assertTrue(interfaces.isEmpty()); @@ -305,7 +305,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetAllInterfaces() { + void testGetAllInterfaces() { Set interfaces = getAllInterfaces(testType.asType()); assertEquals(4, interfaces.size()); Iterator iterator = interfaces.iterator(); @@ -328,7 +328,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetType() { + void testGetType() { TypeElement element = TypeUtils.getType(processingEnv, String.class); assertEquals(element, TypeUtils.getType(processingEnv, element.asType())); assertEquals(element, TypeUtils.getType(processingEnv, "java.lang.String")); @@ -340,7 +340,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetSuperType() { + void testGetSuperType() { TypeElement gtsTypeElement = getSuperType(testType); assertEquals(gtsTypeElement, getType(GenericTestService.class)); TypeElement dtsTypeElement = getSuperType(gtsTypeElement); @@ -356,7 +356,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetAllSuperTypes() { + void testGetAllSuperTypes() { Set allSuperTypes = getAllSuperTypes(testType); Iterator iterator = allSuperTypes.iterator(); assertEquals(3, allSuperTypes.size()); @@ -376,7 +376,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsDeclaredType() { + void testIsDeclaredType() { assertTrue(isDeclaredType(testType)); assertTrue(isDeclaredType(testType.asType())); assertFalse(isDeclaredType((Element) null)); @@ -387,7 +387,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testOfDeclaredType() { + void testOfDeclaredType() { assertEquals(testType.asType(), ofDeclaredType(testType)); assertEquals(testType.asType(), ofDeclaredType(testType.asType())); assertEquals(ofDeclaredType(testType), ofDeclaredType(testType.asType())); @@ -397,7 +397,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testIsTypeElement() { + void testIsTypeElement() { assertTrue(isTypeElement(testType)); assertTrue(isTypeElement(testType.asType())); @@ -406,7 +406,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testOfTypeElement() { + void testOfTypeElement() { assertEquals(testType, ofTypeElement(testType)); assertEquals(testType, ofTypeElement(testType.asType())); @@ -415,7 +415,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testOfDeclaredTypes() { + void testOfDeclaredTypes() { Set declaredTypes = ofDeclaredTypes(asList(getType(String.class), getType(TestServiceImpl.class), getType(Color.class))); assertTrue(declaredTypes.contains(getType(String.class).asType())); assertTrue(declaredTypes.contains(getType(TestServiceImpl.class).asType())); @@ -425,7 +425,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testListDeclaredTypes() { + void testListDeclaredTypes() { List types = listDeclaredTypes(asList(testType, testType, testType)); assertEquals(1, types.size()); assertEquals(ofDeclaredType(testType), types.get(0)); @@ -435,7 +435,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testListTypeElements() { + void testListTypeElements() { List typeElements = listTypeElements(asList(testType.asType(), ofDeclaredType(testType))); assertEquals(1, typeElements.size()); assertEquals(testType, typeElements.get(0)); @@ -463,7 +463,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest { } @Test - public void testGetResourceName() { + void testGetResourceName() { assertEquals("java/lang/String.class", getResourceName("java.lang.String")); assertNull(getResourceName(null)); } diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/CompilerTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/CompilerTest.java index e633e0fba8..071e1b26c8 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/CompilerTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/CompilerTest.java @@ -23,10 +23,10 @@ import java.io.IOException; /** * The Compiler test case */ -public class CompilerTest { +class CompilerTest { @Test - public void testCompile() throws IOException { + void testCompile() throws IOException { Compiler compiler = new Compiler(); compiler.compile( TestServiceImpl.class, diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/DefaultRestServiceTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/DefaultRestServiceTest.java index 6921bbd96a..d7b73c4abc 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/DefaultRestServiceTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/DefaultRestServiceTest.java @@ -31,10 +31,10 @@ import java.io.IOException; * * @since 2.7.6 */ -public class DefaultRestServiceTest { +class DefaultRestServiceTest { @Test - public void test() throws IOException { + void test() throws IOException { Compiler compiler = new Compiler(); compiler.compile(User.class, RestService.class, diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/RestServiceTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/RestServiceTest.java index fcb444e251..5f0ed6e093 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/RestServiceTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/RestServiceTest.java @@ -30,10 +30,10 @@ import java.io.IOException; * * @since 2.7.6 */ -public class RestServiceTest { +class RestServiceTest { @Test - public void test() throws IOException { + void test() throws IOException { Compiler compiler = new Compiler(); compiler.compile(User.class, RestService.class, StandardRestService.class, diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/SpringRestServiceTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/SpringRestServiceTest.java index f2ebe1d3dd..ce17abd592 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/SpringRestServiceTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/SpringRestServiceTest.java @@ -29,10 +29,10 @@ import java.io.IOException; * * @since 2.7.6 */ -public class SpringRestServiceTest { +class SpringRestServiceTest { @Test - public void test() throws IOException { + void test() throws IOException { Compiler compiler = new Compiler(); compiler.compile(User.class, RestService.class, SpringRestService.class); } diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/StandardRestServiceTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/StandardRestServiceTest.java index bba4d54d2d..e55fdf3da4 100644 --- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/StandardRestServiceTest.java +++ b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/StandardRestServiceTest.java @@ -29,10 +29,10 @@ import java.io.IOException; * * @since 2.7.6 */ -public class StandardRestServiceTest { +class StandardRestServiceTest { @Test - public void test() throws IOException { + void test() throws IOException { Compiler compiler = new Compiler(); compiler.compile(User.class, RestService.class, StandardRestService.class); } diff --git a/dubbo-metadata/dubbo-metadata-report-redis/src/test/java/org/apache/dubbo/metadata/store/redis/RedisMetadataReportTest.java b/dubbo-metadata/dubbo-metadata-report-redis/src/test/java/org/apache/dubbo/metadata/store/redis/RedisMetadataReportTest.java index 445363cb79..c9b4e125de 100644 --- a/dubbo-metadata/dubbo-metadata-report-redis/src/test/java/org/apache/dubbo/metadata/store/redis/RedisMetadataReportTest.java +++ b/dubbo-metadata/dubbo-metadata-report-redis/src/test/java/org/apache/dubbo/metadata/store/redis/RedisMetadataReportTest.java @@ -46,7 +46,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE; import static org.apache.dubbo.common.constants.CommonConstants.SYNC_REPORT_KEY; import static redis.embedded.RedisServer.newRedisServer; -public class RedisMetadataReportTest { +class RedisMetadataReportTest { private static final String REDIS_URL_TEMPLATE = "redis://%slocalhost:%d", @@ -107,12 +107,12 @@ public class RedisMetadataReportTest { } @Test - public void testAsyncStoreProvider() throws ClassNotFoundException { + void testAsyncStoreProvider() throws ClassNotFoundException { testStoreProvider(redisMetadataReport, "1.0.0.redis.md.p1", 3000); } @Test - public void testSyncStoreProvider() throws ClassNotFoundException { + void testSyncStoreProvider() throws ClassNotFoundException { testStoreProvider(syncRedisMetadataReport, "1.0.0.redis.md.p2", 3); } @@ -146,12 +146,12 @@ public class RedisMetadataReportTest { } @Test - public void testAsyncStoreConsumer() throws ClassNotFoundException { + void testAsyncStoreConsumer() throws ClassNotFoundException { testStoreConsumer(redisMetadataReport, "1.0.0.redis.md.c1", 3000); } @Test - public void testSyncStoreConsumer() throws ClassNotFoundException { + void testSyncStoreConsumer() throws ClassNotFoundException { testStoreConsumer(syncRedisMetadataReport, "1.0.0.redis.md.c2", 3); } @@ -216,12 +216,12 @@ public class RedisMetadataReportTest { } @Test - public void testAuthRedisMetadata() throws ClassNotFoundException { + void testAuthRedisMetadata() throws ClassNotFoundException { testStoreProvider(redisMetadataReport, "1.0.0.redis.md.p1", 3000); } @Test - public void testWrongAuthRedisMetadata() throws ClassNotFoundException { + void testWrongAuthRedisMetadata() throws ClassNotFoundException { registryUrl = registryUrl.setPassword("123456"); redisMetadataReport = (RedisMetadataReport) new RedisMetadataReportFactory().createMetadataReport(registryUrl); try { diff --git a/dubbo-metadata/dubbo-metadata-report-zookeeper/src/test/java/org/apache/dubbo/metadata/store/zookeeper/ZookeeperMetadataReportTest.java b/dubbo-metadata/dubbo-metadata-report-zookeeper/src/test/java/org/apache/dubbo/metadata/store/zookeeper/ZookeeperMetadataReportTest.java index c585db9083..183185514b 100644 --- a/dubbo-metadata/dubbo-metadata-report-zookeeper/src/test/java/org/apache/dubbo/metadata/store/zookeeper/ZookeeperMetadataReportTest.java +++ b/dubbo-metadata/dubbo-metadata-report-zookeeper/src/test/java/org/apache/dubbo/metadata/store/zookeeper/ZookeeperMetadataReportTest.java @@ -53,7 +53,7 @@ import static org.apache.dubbo.metadata.ServiceNameMapping.DEFAULT_MAPPING_GROUP /** * 2018/10/9 */ -public class ZookeeperMetadataReportTest { +class ZookeeperMetadataReportTest { private ZookeeperMetadataReport zookeeperMetadataReport; private URL registryUrl; private ZookeeperMetadataReportFactory zookeeperMetadataReportFactory; @@ -78,7 +78,7 @@ public class ZookeeperMetadataReportTest { } @Test - public void testStoreProvider() throws ClassNotFoundException, InterruptedException { + void testStoreProvider() throws ClassNotFoundException, InterruptedException { String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService"; String version = "1.0.0.zk.md"; String group = null; @@ -106,7 +106,7 @@ public class ZookeeperMetadataReportTest { @Test - public void testConsumer() throws ClassNotFoundException, InterruptedException { + void testConsumer() throws ClassNotFoundException, InterruptedException { String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService"; String version = "1.0.0.zk.md"; String group = null; @@ -130,7 +130,7 @@ public class ZookeeperMetadataReportTest { } @Test - public void testDoSaveMetadata() throws ExecutionException, InterruptedException { + void testDoSaveMetadata() throws ExecutionException, InterruptedException { String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService"; String version = "1.0.0"; String group = null; @@ -149,7 +149,7 @@ public class ZookeeperMetadataReportTest { } @Test - public void testDoRemoveMetadata() throws ExecutionException, InterruptedException { + void testDoRemoveMetadata() throws ExecutionException, InterruptedException { String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService"; String version = "1.0.0"; String group = null; @@ -172,7 +172,7 @@ public class ZookeeperMetadataReportTest { } @Test - public void testDoGetExportedURLs() throws ExecutionException, InterruptedException { + void testDoGetExportedURLs() throws ExecutionException, InterruptedException { String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService"; String version = "1.0.0"; String group = null; @@ -194,7 +194,7 @@ public class ZookeeperMetadataReportTest { } @Test - public void testDoSaveSubscriberData() throws ExecutionException, InterruptedException { + void testDoSaveSubscriberData() throws ExecutionException, InterruptedException { String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService"; String version = "1.0.0"; String group = null; @@ -214,7 +214,7 @@ public class ZookeeperMetadataReportTest { } @Test - public void testDoGetSubscribedURLs() throws ExecutionException, InterruptedException { + void testDoGetSubscribedURLs() throws ExecutionException, InterruptedException { String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService"; String version = "1.0.0"; String group = null; @@ -279,7 +279,7 @@ public class ZookeeperMetadataReportTest { @Test - public void testMapping() throws InterruptedException { + void testMapping() throws InterruptedException { String serviceKey = ZookeeperMetadataReportTest.class.getName(); URL url = URL.valueOf("test://127.0.0.1:8888/" + serviceKey); String appNames = "demo1,demo2"; @@ -308,7 +308,7 @@ public class ZookeeperMetadataReportTest { } @Test - public void testAppMetadata() { + void testAppMetadata() { String serviceKey = ZookeeperMetadataReportTest.class.getName(); String appName = "demo"; URL url = URL.valueOf("test://127.0.0.1:8888/" + serviceKey); diff --git a/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/aggregate/TimeWindowCounterTest.java b/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/aggregate/TimeWindowCounterTest.java index 0b49925126..4ff6758020 100644 --- a/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/aggregate/TimeWindowCounterTest.java +++ b/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/aggregate/TimeWindowCounterTest.java @@ -20,10 +20,10 @@ package org.apache.dubbo.metrics.aggregate; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class TimeWindowCounterTest { +class TimeWindowCounterTest { @Test - public void test() throws Exception { + void test() throws Exception { TimeWindowCounter counter = new TimeWindowCounter(12, 1); counter.increment(); Assertions.assertEquals(counter.get(), 1); @@ -34,4 +34,4 @@ public class TimeWindowCounterTest { Assertions.assertEquals(counter.get(), 0); Assertions.assertTrue(counter.bucketLivedSeconds() < 1); } -} +} \ No newline at end of file diff --git a/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/aggregate/TimeWindowQuantileTest.java b/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/aggregate/TimeWindowQuantileTest.java index f3364be038..7e1d416652 100644 --- a/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/aggregate/TimeWindowQuantileTest.java +++ b/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/aggregate/TimeWindowQuantileTest.java @@ -20,10 +20,10 @@ package org.apache.dubbo.metrics.aggregate; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class TimeWindowQuantileTest { +class TimeWindowQuantileTest { @Test - public void test() throws Exception { + void test() throws Exception { TimeWindowQuantile quantile = new TimeWindowQuantile(100, 12, 1); for (int i = 1; i <= 100; i++) { quantile.add(i); @@ -34,4 +34,4 @@ public class TimeWindowQuantileTest { Thread.sleep(1000); Assertions.assertEquals(quantile.quantile(0.99), Double.NaN); } -} +} \ No newline at end of file diff --git a/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/collector/AggregateMetricsCollectorTest.java b/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/collector/AggregateMetricsCollectorTest.java index 0b3317a9a2..d654a68047 100644 --- a/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/collector/AggregateMetricsCollectorTest.java +++ b/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/collector/AggregateMetricsCollectorTest.java @@ -25,6 +25,7 @@ import org.apache.dubbo.config.ApplicationConfig; import org.apache.dubbo.config.MetricsConfig; import org.apache.dubbo.config.nested.AggregationConfig; import org.apache.dubbo.rpc.model.ApplicationModel; + import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -34,9 +35,12 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static org.apache.dubbo.common.constants.MetricsConstants.*; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_GROUP_KEY; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_INTERFACE_KEY; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_METHOD_KEY; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_VERSION_KEY; -public class AggregateMetricsCollectorTest { +class AggregateMetricsCollectorTest { private ApplicationModel applicationModel; private DefaultMetricsCollector defaultCollector; @@ -77,7 +81,7 @@ public class AggregateMetricsCollectorTest { } @Test - public void testRequestsMetrics() { + void testRequestsMetrics() { AggregateMetricsCollector collector = new AggregateMetricsCollector(applicationModel); defaultCollector.increaseTotalRequests(interfaceName, methodName, group, version); defaultCollector.increaseSucceedRequests(interfaceName, methodName, group, version); @@ -109,7 +113,7 @@ public class AggregateMetricsCollectorTest { } @Test - public void testRTMetrics() { + void testRTMetrics() { AggregateMetricsCollector collector = new AggregateMetricsCollector(applicationModel); defaultCollector.addRT(interfaceName, methodName, group, version, 10L); diff --git a/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/filter/MetricsFilterTest.java b/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/filter/MetricsFilterTest.java index dbe680637a..34a828061a 100644 --- a/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/filter/MetricsFilterTest.java +++ b/dubbo-metrics/dubbo-metrics-api/src/test/java/org/apache/dubbo/metrics/filter/MetricsFilterTest.java @@ -17,18 +17,6 @@ package org.apache.dubbo.metrics.filter; -import static org.apache.dubbo.common.constants.MetricsConstants.TAG_GROUP_KEY; -import static org.apache.dubbo.common.constants.MetricsConstants.TAG_INTERFACE_KEY; -import static org.apache.dubbo.common.constants.MetricsConstants.TAG_METHOD_KEY; -import static org.apache.dubbo.common.constants.MetricsConstants.TAG_VERSION_KEY; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - import org.apache.dubbo.common.metrics.collector.DefaultMetricsCollector; import org.apache.dubbo.common.metrics.model.MetricsKey; import org.apache.dubbo.common.metrics.model.sample.MetricSample; @@ -39,12 +27,25 @@ import org.apache.dubbo.rpc.Result; import org.apache.dubbo.rpc.RpcException; import org.apache.dubbo.rpc.RpcInvocation; import org.apache.dubbo.rpc.model.ApplicationModel; + import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class MetricsFilterTest { +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_GROUP_KEY; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_INTERFACE_KEY; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_METHOD_KEY; +import static org.apache.dubbo.common.constants.MetricsConstants.TAG_VERSION_KEY; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + +class MetricsFilterTest { private ApplicationModel applicationModel; private MetricsFilter filter; @@ -78,7 +79,7 @@ public class MetricsFilterTest { } @Test - public void testCollectDisabled() { + void testCollectDisabled() { given(invoker.invoke(invocation)).willReturn(new AppResponse("success")); filter.invoke(invoker, invocation); @@ -87,7 +88,7 @@ public class MetricsFilterTest { } @Test - public void testFailedRequests() { + void testFailedRequests() { collector.setCollectEnabled(true); given(invoker.invoke(invocation)).willThrow(new RpcException("failed")); initParam(); @@ -114,7 +115,7 @@ public class MetricsFilterTest { @Test - public void testBusinessFailedRequests() { + void testBusinessFailedRequests() { collector.setCollectEnabled(true); given(invoker.invoke(invocation)).willThrow(new RpcException(RpcException.BIZ_EXCEPTION)); @@ -142,7 +143,7 @@ public class MetricsFilterTest { } @Test - public void testSucceedRequests() { + void testSucceedRequests() { collector.setCollectEnabled(true); given(invoker.invoke(invocation)).willReturn(new AppResponse("success")); initParam(); @@ -165,7 +166,7 @@ public class MetricsFilterTest { } @Test - public void testMissingGroup() { + void testMissingGroup() { collector.setCollectEnabled(true); given(invoker.invoke(invocation)).willReturn(new AppResponse("success")); invocation.setTargetServiceUniqueName(INTERFACE_NAME + ":" + VERSION); @@ -188,7 +189,7 @@ public class MetricsFilterTest { } @Test - public void testMissingVersion() { + void testMissingVersion() { collector.setCollectEnabled(true); given(invoker.invoke(invocation)).willReturn(new AppResponse("success")); invocation.setTargetServiceUniqueName(GROUP + "/" + INTERFACE_NAME); @@ -211,7 +212,7 @@ public class MetricsFilterTest { } @Test - public void testMissingGroupAndVersion() { + void testMissingGroupAndVersion() { collector.setCollectEnabled(true); given(invoker.invoke(invocation)).willReturn(new AppResponse("success")); invocation.setTargetServiceUniqueName(INTERFACE_NAME); diff --git a/dubbo-metrics/dubbo-metrics-prometheus/src/test/java/org/apache/dubbo/metrics/prometheus/PrometheusMetricsReporterFactoryTest.java b/dubbo-metrics/dubbo-metrics-prometheus/src/test/java/org/apache/dubbo/metrics/prometheus/PrometheusMetricsReporterFactoryTest.java index f0f87a81ab..ab6956860c 100644 --- a/dubbo-metrics/dubbo-metrics-prometheus/src/test/java/org/apache/dubbo/metrics/prometheus/PrometheusMetricsReporterFactoryTest.java +++ b/dubbo-metrics/dubbo-metrics-prometheus/src/test/java/org/apache/dubbo/metrics/prometheus/PrometheusMetricsReporterFactoryTest.java @@ -20,13 +20,14 @@ package org.apache.dubbo.metrics.prometheus; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.metrics.MetricsReporter; import org.apache.dubbo.rpc.model.ApplicationModel; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class PrometheusMetricsReporterFactoryTest { +class PrometheusMetricsReporterFactoryTest { @Test - public void test() { + void test() { ApplicationModel applicationModel = ApplicationModel.defaultModel(); PrometheusMetricsReporterFactory factory = new PrometheusMetricsReporterFactory(applicationModel); MetricsReporter reporter = factory.createMetricsReporter(URL.valueOf("prometheus://localhost:9090/")); diff --git a/dubbo-metrics/dubbo-metrics-prometheus/src/test/java/org/apache/dubbo/metrics/prometheus/PrometheusMetricsReporterTest.java b/dubbo-metrics/dubbo-metrics-prometheus/src/test/java/org/apache/dubbo/metrics/prometheus/PrometheusMetricsReporterTest.java index a429ce35a1..5ea7d9ffe3 100644 --- a/dubbo-metrics/dubbo-metrics-prometheus/src/test/java/org/apache/dubbo/metrics/prometheus/PrometheusMetricsReporterTest.java +++ b/dubbo-metrics/dubbo-metrics-prometheus/src/test/java/org/apache/dubbo/metrics/prometheus/PrometheusMetricsReporterTest.java @@ -17,11 +17,12 @@ package org.apache.dubbo.metrics.prometheus; -import io.micrometer.prometheus.PrometheusMeterRegistry; import org.apache.dubbo.common.utils.NetUtils; import org.apache.dubbo.config.MetricsConfig; import org.apache.dubbo.config.nested.PrometheusConfig; import org.apache.dubbo.rpc.model.ApplicationModel; + +import io.micrometer.prometheus.PrometheusMeterRegistry; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; @@ -40,7 +41,7 @@ import java.util.stream.Collectors; import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMETHEUS; -public class PrometheusMetricsReporterTest { +class PrometheusMetricsReporterTest { private MetricsConfig metricsConfig; private ApplicationModel applicationModel; @@ -58,7 +59,7 @@ public class PrometheusMetricsReporterTest { } @Test - public void testJvmMetrics() { + void testJvmMetrics() { metricsConfig.setEnableJvmMetrics(true); PrometheusMetricsReporter reporter = new PrometheusMetricsReporter(metricsConfig.toUrl(), applicationModel); reporter.init(); @@ -72,7 +73,7 @@ public class PrometheusMetricsReporterTest { } @Test - public void testExporter() { + void testExporter() { int port = NetUtils.getAvailablePort(); PrometheusConfig prometheusConfig = new PrometheusConfig(); @@ -101,7 +102,7 @@ public class PrometheusMetricsReporterTest { } @Test - public void testPushgateway() { + void testPushgateway() { PrometheusConfig prometheusConfig = new PrometheusConfig(); PrometheusConfig.Pushgateway pushgateway = new PrometheusConfig.Pushgateway(); pushgateway.setJob("mock"); diff --git a/dubbo-monitor/dubbo-monitor-api/src/test/java/org/apache/dubbo/monitor/support/AbstractMonitorFactoryTest.java b/dubbo-monitor/dubbo-monitor-api/src/test/java/org/apache/dubbo/monitor/support/AbstractMonitorFactoryTest.java index 06e1251dd9..821ab63814 100644 --- a/dubbo-monitor/dubbo-monitor-api/src/test/java/org/apache/dubbo/monitor/support/AbstractMonitorFactoryTest.java +++ b/dubbo-monitor/dubbo-monitor-api/src/test/java/org/apache/dubbo/monitor/support/AbstractMonitorFactoryTest.java @@ -29,7 +29,7 @@ import java.util.List; /** * AbstractMonitorFactoryTest */ -public class AbstractMonitorFactoryTest { +class AbstractMonitorFactoryTest { private MonitorFactory monitorFactory = new AbstractMonitorFactory() { @@ -61,7 +61,7 @@ public class AbstractMonitorFactoryTest { }; @Test - public void testMonitorFactoryCache() throws Exception { + void testMonitorFactoryCache() throws Exception { URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostAddress() + ":2233"); Monitor monitor1 = monitorFactory.getMonitor(url); Monitor monitor2 = monitorFactory.getMonitor(url); @@ -74,7 +74,7 @@ public class AbstractMonitorFactoryTest { } @Test - public void testMonitorFactoryIpCache() throws Exception { + void testMonitorFactoryIpCache() throws Exception { URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":2233"); Monitor monitor1 = monitorFactory.getMonitor(url); Monitor monitor2 = monitorFactory.getMonitor(url); @@ -87,7 +87,7 @@ public class AbstractMonitorFactoryTest { } @Test - public void testMonitorFactoryGroupCache() throws Exception { + void testMonitorFactoryGroupCache() throws Exception { URL url1 = URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"); URL url2 = URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"); Monitor monitor1 = monitorFactory.getMonitor(url1); @@ -100,4 +100,4 @@ public class AbstractMonitorFactoryTest { Assertions.assertNotSame(monitor1, monitor2); } -} +} \ No newline at end of file diff --git a/dubbo-monitor/dubbo-monitor-api/src/test/java/org/apache/dubbo/monitor/support/MonitorFilterTest.java b/dubbo-monitor/dubbo-monitor-api/src/test/java/org/apache/dubbo/monitor/support/MonitorFilterTest.java index 07db013755..6a644a5fec 100644 --- a/dubbo-monitor/dubbo-monitor-api/src/test/java/org/apache/dubbo/monitor/support/MonitorFilterTest.java +++ b/dubbo-monitor/dubbo-monitor-api/src/test/java/org/apache/dubbo/monitor/support/MonitorFilterTest.java @@ -56,7 +56,7 @@ import static org.mockito.Mockito.verify; /** * MonitorFilterTest */ -public class MonitorFilterTest { +class MonitorFilterTest { private volatile URL lastStatistics; @@ -114,7 +114,7 @@ public class MonitorFilterTest { }; @Test - public void testFilter() throws Exception { + void testFilter() throws Exception { MonitorFilter monitorFilter = new MonitorFilter(); monitorFilter.setMonitorFactory(monitorFactory); Invocation invocation = new RpcInvocation("aaa", MonitorService.class.getName(), "", new Class[0], new Object[0]); @@ -143,7 +143,7 @@ public class MonitorFilterTest { } @Test - public void testSkipMonitorIfNotHasKey() { + void testSkipMonitorIfNotHasKey() { MonitorFilter monitorFilter = new MonitorFilter(); MonitorFactory mockMonitorFactory = mock(MonitorFactory.class); monitorFilter.setMonitorFactory(mockMonitorFactory); @@ -157,7 +157,7 @@ public class MonitorFilterTest { } @Test - public void testGenericFilter() throws Exception { + void testGenericFilter() throws Exception { MonitorFilter monitorFilter = new MonitorFilter(); monitorFilter.setMonitorFactory(monitorFactory); Invocation invocation = new RpcInvocation("$invoke", MonitorService.class.getName(), "", new Class[]{String.class, String[].class, Object[].class}, new Object[]{"xxx", new String[]{}, new Object[]{}}); @@ -186,7 +186,7 @@ public class MonitorFilterTest { } @Test - public void testSafeFailForMonitorCollectFail() { + void testSafeFailForMonitorCollectFail() { MonitorFilter monitorFilter = new MonitorFilter(); MonitorFactory mockMonitorFactory = mock(MonitorFactory.class); Monitor mockMonitor = mock(Monitor.class); @@ -200,7 +200,7 @@ public class MonitorFilterTest { } @Test - public void testOnResponseWithoutStartTime() { + void testOnResponseWithoutStartTime() { MonitorFilter monitorFilter = new MonitorFilter(); MonitorFactory mockMonitorFactory = mock(MonitorFactory.class); Monitor mockMonitor = mock(Monitor.class); @@ -215,7 +215,7 @@ public class MonitorFilterTest { } @Test - public void testOnErrorWithoutStartTime() { + void testOnErrorWithoutStartTime() { MonitorFilter monitorFilter = new MonitorFilter(); MonitorFactory mockMonitorFactory = mock(MonitorFactory.class); Monitor mockMonitor = mock(Monitor.class); @@ -226,4 +226,4 @@ public class MonitorFilterTest { Throwable rpcException = new RpcException(); monitorFilter.onError(rpcException, serviceInvoker, invocation); } -} +} \ No newline at end of file diff --git a/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorFactoryTest.java b/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorFactoryTest.java index 44247d8000..f7b1f0734b 100644 --- a/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorFactoryTest.java +++ b/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorFactoryTest.java @@ -36,7 +36,7 @@ import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.verify; import static org.mockito.MockitoAnnotations.initMocks; -public class DubboMonitorFactoryTest { +class DubboMonitorFactoryTest { private DubboMonitorFactory dubboMonitorFactory; @Mock private ProxyFactory proxyFactory; @@ -50,7 +50,7 @@ public class DubboMonitorFactoryTest { } @Test - public void testCreateMonitor() { + void testCreateMonitor() { URL urlWithoutPath = URL.valueOf("http://10.10.10.11"); Monitor monitor = dubboMonitorFactory.createMonitor(urlWithoutPath); assertThat(monitor, not(nullValue())); @@ -65,4 +65,4 @@ public class DubboMonitorFactoryTest { Invoker invoker = invokerArgumentCaptor.getValue(); assertThat(invoker.getUrl().getParameter(REFERENCE_FILTER_KEY), containsString("testFilter")); } -} +} \ No newline at end of file diff --git a/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorTest.java b/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorTest.java index 694280e4d5..856185b625 100644 --- a/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorTest.java +++ b/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorTest.java @@ -65,7 +65,7 @@ import static org.mockito.Mockito.verify; /** * DubboMonitorTest */ -public class DubboMonitorTest { +class DubboMonitorTest { private final Invoker monitorInvoker = new Invoker() { @Override @@ -105,7 +105,7 @@ public class DubboMonitorTest { }; @Test - public void testCount() throws Exception { + void testCount() throws Exception { DubboMonitor monitor = new DubboMonitor(monitorInvoker, monitorService); URL statistics = new URLBuilder(DUBBO_PROTOCOL, "10.20.153.10", 0) .addParameter(APPLICATION_KEY, "morgan") @@ -141,7 +141,7 @@ public class DubboMonitorTest { } @Test - public void testMonitorFactory() throws Exception { + void testMonitorFactory() throws Exception { MockMonitorService monitorService = new MockMonitorService(); URL statistics = new URLBuilder(DUBBO_PROTOCOL, "10.20.153.10", 0) .addParameter(APPLICATION_KEY, "morgan") @@ -191,7 +191,7 @@ public class DubboMonitorTest { } @Test - public void testAvailable() { + void testAvailable() { Invoker invoker = mock(Invoker.class); MonitorService monitorService = mock(MonitorService.class); @@ -204,7 +204,7 @@ public class DubboMonitorTest { } @Test - public void testSum() { + void testSum() { URL statistics = new URLBuilder(DUBBO_PROTOCOL, "10.20.153.11", 0) .addParameter(APPLICATION_KEY, "morgan") .addParameter(INTERFACE_KEY, "MemberService") @@ -246,7 +246,7 @@ public class DubboMonitorTest { } @Test - public void testLookUp() { + void testLookUp() { Invoker invoker = mock(Invoker.class); MonitorService monitorService = mock(MonitorService.class); @@ -258,4 +258,4 @@ public class DubboMonitorTest { verify(monitorService).lookup(eq(queryUrl)); } -} +} \ No newline at end of file diff --git a/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/MetricsFilterTest.java b/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/MetricsFilterTest.java index ac6dd55206..154e0848c3 100644 --- a/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/MetricsFilterTest.java +++ b/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/MetricsFilterTest.java @@ -65,7 +65,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; -public class MetricsFilterTest { +class MetricsFilterTest { private int port = NetUtils.getAvailablePort(20880 + new Random().nextInt(10000)); private final Function> invokerFunction = (url) -> { @@ -93,7 +93,7 @@ public class MetricsFilterTest { } @Test - public void testAll() { + void testAll() { List> testcases = new LinkedList<>(); testcases.add(() -> { testConsumerSuccess(); @@ -353,4 +353,4 @@ public class MetricsFilterTest { Assertions.assertEquals(50.0 / 100.0, methodMetricMap.get("org.apache.dubbo.monitor.dubbo.service.DemoService.void echo(Integer)").get("success_rate")); } -} +} \ No newline at end of file diff --git a/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/StatisticsTest.java b/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/StatisticsTest.java index 3f9b1bae15..ca2b2b869d 100644 --- a/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/StatisticsTest.java +++ b/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/StatisticsTest.java @@ -40,9 +40,9 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; -public class StatisticsTest { +class StatisticsTest { @Test - public void testEquals() { + void testEquals() { URL statistics = new URLBuilder(DUBBO_PROTOCOL, "10.20.153.10", 0) .addParameter(APPLICATION_KEY, "morgan") .addParameter(INTERFACE_KEY, "MemberService") @@ -76,7 +76,7 @@ public class StatisticsTest { } @Test - public void testToString() { + void testToString() { Statistics statistics = new Statistics(new ServiceConfigURL("dubbo", "10.20.153.10", 0)); statistics.setApplication("demo"); statistics.setMethod("findPerson"); @@ -106,4 +106,4 @@ public class StatisticsTest { MatcherAssert.assertThat(statisticsWithDetailInfo.getGroup(), equalTo(statistics.getGroup())); MatcherAssert.assertThat(statisticsWithDetailInfo, not(equalTo(statistics))); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/AccessKeyAuthenticatorTest.java b/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/AccessKeyAuthenticatorTest.java index bc9b8f939b..163ca15d88 100644 --- a/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/AccessKeyAuthenticatorTest.java +++ b/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/AccessKeyAuthenticatorTest.java @@ -134,4 +134,4 @@ class AccessKeyAuthenticatorTest { String signature1 = helper.getSignature(url, invocation, secretKey, String.valueOf(System.currentTimeMillis())); assertNotEquals(signature, signature1); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/DefaultAccessKeyStorageTest.java b/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/DefaultAccessKeyStorageTest.java index 296be9f986..1e0603a0d4 100644 --- a/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/DefaultAccessKeyStorageTest.java +++ b/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/DefaultAccessKeyStorageTest.java @@ -40,4 +40,4 @@ class DefaultAccessKeyStorageTest { assertEquals(accessKey.getAccessKey(), "ak"); assertEquals(accessKey.getSecretKey(), "sk"); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/filter/ConsumerSignFilterTest.java b/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/filter/ConsumerSignFilterTest.java index 8a520813d8..0dafb77c9f 100644 --- a/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/filter/ConsumerSignFilterTest.java +++ b/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/filter/ConsumerSignFilterTest.java @@ -61,4 +61,4 @@ class ConsumerSignFilterTest { consumerSignFilter.invoke(invoker, invocation); verify(invocation, times(1)).setAttachment(eq(Constants.REQUEST_SIGNATURE_KEY), anyString()); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/filter/ProviderAuthFilterTest.java b/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/filter/ProviderAuthFilterTest.java index 6e12f6fe56..e6f614afe8 100644 --- a/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/filter/ProviderAuthFilterTest.java +++ b/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/filter/ProviderAuthFilterTest.java @@ -187,4 +187,4 @@ class ProviderAuthFilterTest { Result result = providerAuthFilter.invoke(invoker, invocation); assertNull(result); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/utils/SignatureUtilsTest.java b/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/utils/SignatureUtilsTest.java index d6bbae6e47..ef5c1a9f26 100644 --- a/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/utils/SignatureUtilsTest.java +++ b/dubbo-plugin/dubbo-auth/src/test/java/org/apache/dubbo/auth/utils/SignatureUtilsTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import java.util.ArrayList; -public class SignatureUtilsTest { +class SignatureUtilsTest { @Test void testEncryptWithObject() { @@ -35,4 +35,4 @@ public class SignatureUtilsTest { String encryptWithNoParams = SignatureUtils.sign(null, "TestMethod#hello", "TOKEN"); Assertions.assertEquals(encryptWithNoParams, "2DGkTcyXg4plU24rY8MZkEJwOMRW3o+wUP3HssRc3EE="); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/CommandContextFactoryTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/CommandContextFactoryTest.java index d5d983c212..ffe32eefe9 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/CommandContextFactoryTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/CommandContextFactoryTest.java @@ -24,9 +24,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CommandContextFactoryTest { +class CommandContextFactoryTest { @Test - public void testNewInstance() throws Exception { + void testNewInstance() throws Exception { CommandContext context = CommandContextFactory.newInstance("test"); assertThat(context.getCommandName(), equalTo("test")); context = CommandContextFactory.newInstance("command", new String[]{"hello"}, true); @@ -34,4 +34,4 @@ public class CommandContextFactoryTest { assertThat(context.getArgs(), Matchers.arrayContaining("hello")); assertTrue(context.isHttp()); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/CommandContextTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/CommandContextTest.java index d6a6d3ab38..098ba908fa 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/CommandContextTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/CommandContextTest.java @@ -28,9 +28,9 @@ import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CommandContextTest { +class CommandContextTest { @Test - public void test() throws Exception { + void test() throws Exception { CommandContext context = new CommandContext("test", new String[]{"hello"}, true); Object request = new Object(); context.setOriginRequest(request); @@ -53,4 +53,4 @@ public class CommandContextTest { assertFalse(context.isHttp()); assertThat(context.getRemote(), is(channel)); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/DefaultCommandExecutorTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/DefaultCommandExecutorTest.java index 8db17bf952..dc988059d4 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/DefaultCommandExecutorTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/DefaultCommandExecutorTest.java @@ -25,9 +25,9 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class DefaultCommandExecutorTest { +class DefaultCommandExecutorTest { @Test - public void testExecute1() throws Exception { + void testExecute1() throws Exception { Assertions.assertThrows(NoSuchCommandException.class, () -> { DefaultCommandExecutor executor = new DefaultCommandExecutor(FrameworkModel.defaultModel()); executor.execute(CommandContextFactory.newInstance("not-exit")); @@ -35,9 +35,9 @@ public class DefaultCommandExecutorTest { } @Test - public void testExecute2() throws Exception { + void testExecute2() throws Exception { DefaultCommandExecutor executor = new DefaultCommandExecutor(FrameworkModel.defaultModel()); String result = executor.execute(CommandContextFactory.newInstance("greeting", new String[]{"dubbo"}, false)); assertThat(result, equalTo("greeting dubbo")); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/decoder/HttpCommandDecoderTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/decoder/HttpCommandDecoderTest.java index 2911e23d1b..728766fd3c 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/decoder/HttpCommandDecoderTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/decoder/HttpCommandDecoderTest.java @@ -35,9 +35,9 @@ import static org.hamcrest.Matchers.is; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class HttpCommandDecoderTest { +class HttpCommandDecoderTest { @Test - public void decodeGet() throws Exception { + void decodeGet() throws Exception { HttpRequest request = mock(HttpRequest.class); when(request.uri()).thenReturn("localhost:80/test"); when(request.method()).thenReturn(HttpMethod.GET); @@ -50,7 +50,7 @@ public class HttpCommandDecoderTest { } @Test - public void decodePost() throws Exception { + void decodePost() throws Exception { FullHttpRequest request = mock(FullHttpRequest.class); when(request.uri()).thenReturn("localhost:80/test"); when(request.method()).thenReturn(HttpMethod.POST); @@ -62,4 +62,4 @@ public class HttpCommandDecoderTest { assertThat(context.isHttp(), is(true)); assertThat(context.getArgs(), arrayContaining("b", "d")); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/decoder/TelnetCommandDecoderTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/decoder/TelnetCommandDecoderTest.java index a33b9b1c3e..0bf55efc19 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/decoder/TelnetCommandDecoderTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/decoder/TelnetCommandDecoderTest.java @@ -25,12 +25,12 @@ import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; -public class TelnetCommandDecoderTest { +class TelnetCommandDecoderTest { @Test - public void testDecode() throws Exception { + void testDecode() throws Exception { CommandContext context = TelnetCommandDecoder.decode("test a b"); assertThat(context.getCommandName(), equalTo("test")); assertThat(context.isHttp(), is(false)); assertThat(context.getArgs(), arrayContaining("a", "b")); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ChangeTelnetTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ChangeTelnetTest.java index cb3a3a02d3..1f352a185c 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ChangeTelnetTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ChangeTelnetTest.java @@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; -public class ChangeTelnetTest { +class ChangeTelnetTest { private final DefaultAttributeMap defaultAttributeMap = new DefaultAttributeMap(); private BaseCommand change; @@ -80,14 +80,14 @@ public class ChangeTelnetTest { } @Test - public void testChangeSimpleName() { + void testChangeSimpleName() { ExtensionLoader.getExtensionLoader(Protocol.class).getExtension(DubboProtocol.NAME).export(mockInvoker); String result = change.execute(mockCommandContext, new String[]{"DemoService"}); assertEquals("Used the DemoService as default.\r\nYou can cancel default service by command: cd /", result); } @Test - public void testChangeName() { + void testChangeName() { ExtensionLoader.getExtensionLoader(Protocol.class).getExtension(DubboProtocol.NAME).export(mockInvoker); String result = change.execute(mockCommandContext, new String[]{"org.apache.dubbo.qos.legacy.service.DemoService"}); assertEquals("Used the org.apache.dubbo.qos.legacy.service.DemoService as default.\r\nYou can cancel default service by command: cd /", @@ -95,33 +95,33 @@ public class ChangeTelnetTest { } @Test - public void testChangePath() { + void testChangePath() { ExtensionLoader.getExtensionLoader(Protocol.class).getExtension(DubboProtocol.NAME).export(mockInvoker); String result = change.execute(mockCommandContext, new String[]{"demo"}); assertEquals("Used the demo as default.\r\nYou can cancel default service by command: cd /", result); } @Test - public void testChangeMessageNull() { + void testChangeMessageNull() { String result = change.execute(mockCommandContext, null); assertEquals("Please input service name, eg: \r\ncd XxxService\r\ncd com.xxx.XxxService", result); } @Test - public void testChangeServiceNotExport() { + void testChangeServiceNotExport() { String result = change.execute(mockCommandContext, new String[]{"demo"}); assertEquals("No such service demo", result); } @Test - public void testChangeCancel() { + void testChangeCancel() { String result = change.execute(mockCommandContext, new String[]{".."}); assertEquals("Cancelled default service org.apache.dubbo.rpc.protocol.dubbo.support.DemoService.", result); } @Test - public void testChangeCancel2() { + void testChangeCancel2() { String result = change.execute(mockCommandContext, new String[]{"/"}); assertEquals("Cancelled default service org.apache.dubbo.rpc.protocol.dubbo.support.DemoService.", result); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/CountTelnetTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/CountTelnetTest.java index 5263e69c02..753e3a017e 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/CountTelnetTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/CountTelnetTest.java @@ -43,7 +43,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; -public class CountTelnetTest { +class CountTelnetTest { private BaseCommand count; private MockNettyChannel mockChannel; @@ -75,7 +75,7 @@ public class CountTelnetTest { } @Test - public void test() throws Exception { + void test() throws Exception { String methodName = "sayHello"; String[] args = new String[]{"org.apache.dubbo.qos.legacy.service.DemoService", "sayHello", "1"}; @@ -118,4 +118,4 @@ public class CountTelnetTest { return TelnetUtils.toTable(header, table); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/HelpTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/HelpTest.java index 642637dabc..d0c8f78af9 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/HelpTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/HelpTest.java @@ -25,9 +25,9 @@ import org.mockito.Mockito; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; -public class HelpTest { +class HelpTest { @Test - public void testMainHelp() throws Exception { + void testMainHelp() throws Exception { Help help = new Help(FrameworkModel.defaultModel()); String output = help.execute(Mockito.mock(CommandContext.class), null); assertThat(output, containsString("greeting")); @@ -39,7 +39,7 @@ public class HelpTest { } @Test - public void testGreeting() throws Exception { + void testGreeting() throws Exception { Help help = new Help(FrameworkModel.defaultModel()); String output = help.execute(Mockito.mock(CommandContext.class), new String[]{"greeting"}); assertThat(output, containsString("COMMAND NAME")); @@ -47,4 +47,4 @@ public class HelpTest { assertThat(output, containsString("EXAMPLE")); assertThat(output, containsString("greeting dubbo")); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/InvokeTelnetTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/InvokeTelnetTest.java index 2cac564a5f..4b101ad1ac 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/InvokeTelnetTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/InvokeTelnetTest.java @@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; -public class InvokeTelnetTest { +class InvokeTelnetTest { private FrameworkModel frameworkModel; private BaseCommand invoke; @@ -69,7 +69,7 @@ public class InvokeTelnetTest { } @Test - public void testInvokeWithoutServicePrefixAndWithoutDefaultService() throws RemotingException { + void testInvokeWithoutServicePrefixAndWithoutDefaultService() throws RemotingException { registerProvider(DemoService.class.getName(), new DemoServiceImpl(), DemoService.class); String result = invoke.execute(mockCommandContext, new String[]{"echo(\"ok\")"}); assertTrue(result.contains("If you want to invoke like [invoke sayHello(\"xxxx\")], please execute cd command first," + @@ -77,7 +77,7 @@ public class InvokeTelnetTest { } @Test - public void testInvokeDefaultService() throws RemotingException { + void testInvokeDefaultService() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(DemoService.class.getName()); defaultAttributeMap.attr(SelectTelnet.SELECT_KEY).set(null); given(mockChannel.attr(ChangeTelnet.SERVICE_KEY)).willReturn(defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY)); @@ -90,7 +90,7 @@ public class InvokeTelnetTest { } @Test - public void testInvokeWithSpecifyService() throws RemotingException { + void testInvokeWithSpecifyService() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(null); defaultAttributeMap.attr(SelectTelnet.SELECT_KEY).set(null); @@ -105,7 +105,7 @@ public class InvokeTelnetTest { } @Test - public void testInvokeByPassingNullValue() { + void testInvokeByPassingNullValue() { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(DemoService.class.getName()); defaultAttributeMap.attr(SelectTelnet.SELECT_KEY).set(null); given(mockChannel.attr(ChangeTelnet.SERVICE_KEY)).willReturn(defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY)); @@ -123,7 +123,7 @@ public class InvokeTelnetTest { } @Test - public void testInvokeByPassingEnumValue() throws RemotingException { + void testInvokeByPassingEnumValue() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(DemoService.class.getName()); defaultAttributeMap.attr(SelectTelnet.SELECT_KEY).set(null); @@ -139,7 +139,7 @@ public class InvokeTelnetTest { } @Test - public void testOverriddenMethodWithSpecifyParamType() throws RemotingException { + void testOverriddenMethodWithSpecifyParamType() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(DemoService.class.getName()); defaultAttributeMap.attr(SelectTelnet.SELECT_KEY).set(null); given(mockChannel.attr(ChangeTelnet.SERVICE_KEY)).willReturn(defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY)); @@ -156,7 +156,7 @@ public class InvokeTelnetTest { } @Test - public void testInvokeOverriddenMethodBySelect() throws RemotingException { + void testInvokeOverriddenMethodBySelect() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(DemoService.class.getName()); defaultAttributeMap.attr(SelectTelnet.SELECT_KEY).set(null); defaultAttributeMap.attr(SelectTelnet.SELECT_METHOD_KEY).set(null); @@ -191,7 +191,7 @@ public class InvokeTelnetTest { } @Test - public void testInvokeMethodWithMapParameter() throws RemotingException { + void testInvokeMethodWithMapParameter() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(DemoService.class.getName()); defaultAttributeMap.attr(SelectTelnet.SELECT_KEY).set(null); @@ -209,7 +209,7 @@ public class InvokeTelnetTest { } @Test - public void testInvokeMultiJsonParamMethod() throws RemotingException { + void testInvokeMultiJsonParamMethod() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(DemoService.class.getName()); defaultAttributeMap.attr(SelectTelnet.SELECT_KEY).set(null); @@ -227,7 +227,7 @@ public class InvokeTelnetTest { } @Test - public void testMessageNull() throws RemotingException { + void testMessageNull() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(null); defaultAttributeMap.attr(SelectTelnet.SELECT_KEY).set(null); @@ -243,7 +243,7 @@ public class InvokeTelnetTest { } @Test - public void testInvalidMessage() throws RemotingException { + void testInvalidMessage() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(null); defaultAttributeMap.attr(SelectTelnet.SELECT_KEY).set(null); @@ -267,4 +267,4 @@ public class InvokeTelnetTest { null ); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/LiveTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/LiveTest.java index d924bb2c6b..b655b298db 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/LiveTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/LiveTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class LiveTest { +class LiveTest { private FrameworkModel frameworkModel; @BeforeEach @@ -38,7 +38,7 @@ public class LiveTest { } @Test - public void testExecute() { + void testExecute() { Live live = new Live(frameworkModel); CommandContext commandContext = new CommandContext("live"); String result = live.execute(commandContext, new String[0]); @@ -50,4 +50,4 @@ public class LiveTest { Assertions.assertEquals(result, "true"); Assertions.assertEquals(commandContext.getHttpCode(), 200); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/LsTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/LsTest.java index 58b1a40175..8eb412f907 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/LsTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/LsTest.java @@ -37,7 +37,7 @@ import org.mockito.Mockito; import java.util.HashMap; import java.util.Map; -public class LsTest { +class LsTest { private FrameworkModel frameworkModel; private ModuleServiceRepository repository; @@ -55,7 +55,7 @@ public class LsTest { } @Test - public void testExecute() { + void testExecute() { Ls ls = new Ls(frameworkModel); String result = ls.execute(Mockito.mock(CommandContext.class), new String[0]); System.out.println(result); @@ -100,4 +100,4 @@ public class LsTest { serviceMetadata, methodConfigs, referenceConfig.getInterfaceClassLoader()); repository.registerConsumer(consumerModel); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/OfflineTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/OfflineTest.java index cba896f039..bee74a7448 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/OfflineTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/OfflineTest.java @@ -43,7 +43,7 @@ import static org.mockito.Mockito.mock; * {@link OfflineApp} * {@link OfflineInterface} */ -public class OfflineTest { +class OfflineTest { private FrameworkModel frameworkModel; private ModuleServiceRepository repository; private ProviderModel.RegisterStatedURL registerStatedURL; @@ -61,7 +61,7 @@ public class OfflineTest { } @Test - public void testExecute() { + void testExecute() { Offline offline = new Offline(frameworkModel); String result = offline.execute(mock(CommandContext.class), new String[]{DemoService.class.getName()}); Assertions.assertEquals(result, "OK"); @@ -100,4 +100,4 @@ public class OfflineTest { ); repository.registerProvider(providerModel); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/OnlineTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/OnlineTest.java index 189b7987f2..c7b4c986e8 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/OnlineTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/OnlineTest.java @@ -43,7 +43,7 @@ import static org.mockito.Mockito.mock; * {@link OnlineApp} * {@link OnlineInterface} */ -public class OnlineTest { +class OnlineTest { private FrameworkModel frameworkModel; private ModuleServiceRepository repository; private ProviderModel.RegisterStatedURL registerStatedURL; @@ -61,7 +61,7 @@ public class OnlineTest { } @Test - public void testExecute() { + void testExecute() { Online online = new Online(frameworkModel); String result = online.execute(mock(CommandContext.class), new String[]{DemoService.class.getName()}); Assertions.assertEquals(result, "OK"); @@ -100,4 +100,4 @@ public class OnlineTest { ); repository.registerProvider(providerModel); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PortTelnetTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PortTelnetTest.java index cc01320664..2088c340c7 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PortTelnetTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PortTelnetTest.java @@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; -public class PortTelnetTest { +class PortTelnetTest { private BaseCommand port; private Invoker mockInvoker; @@ -71,7 +71,7 @@ public class PortTelnetTest { * the address converted by NAT. In this case, check port only. */ @Test - public void testListClient() throws Exception { + void testListClient() throws Exception { ExchangeClient client1 = Exchangers.connect("dubbo://127.0.0.1:" + availablePort + "/demo"); ExchangeClient client2 = Exchangers.connect("dubbo://127.0.0.1:" + availablePort + "/demo"); Thread.sleep(100); @@ -86,26 +86,26 @@ public class PortTelnetTest { } @Test - public void testListDetail() throws RemotingException { + void testListDetail() throws RemotingException { String result = port.execute(mockCommandContext, new String[]{"-l"}); assertEquals("dubbo://127.0.0.1:" + availablePort + "", result); } @Test - public void testListAllPort() throws RemotingException { + void testListAllPort() throws RemotingException { String result = port.execute(mockCommandContext, new String[0]); assertEquals("" + availablePort + "", result); } @Test - public void testErrorMessage() throws RemotingException { + void testErrorMessage() throws RemotingException { String result = port.execute(mockCommandContext, new String[]{"a"}); assertEquals("Illegal port a, must be integer.", result); } @Test - public void testNoPort() throws RemotingException { + void testNoPort() throws RemotingException { String result = port.execute(mockCommandContext, new String[]{"-l", "20880"}); assertEquals("No such port 20880", result); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PublishMetadataTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PublishMetadataTest.java index 4aaee6f343..7c763dd96c 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PublishMetadataTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PublishMetadataTest.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class PublishMetadataTest { +class PublishMetadataTest { private FrameworkModel frameworkModel; @BeforeEach @@ -46,7 +46,7 @@ public class PublishMetadataTest { } @Test - public void testExecute() { + void testExecute() { PublishMetadata publishMetadata = new PublishMetadata(frameworkModel); String result = publishMetadata.execute(Mockito.mock(CommandContext.class), new String[0]); @@ -68,4 +68,4 @@ public class PublishMetadataTest { Assertions.assertEquals(result, expectResult); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PwdTelnetTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PwdTelnetTest.java index 3cedda95e8..f3dfc521c0 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PwdTelnetTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/PwdTelnetTest.java @@ -32,7 +32,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; -public class PwdTelnetTest { +class PwdTelnetTest { private static final BaseCommand pwdTelnet = new PwdTelnet(); private Channel mockChannel; private CommandContext mockCommandContext; @@ -55,23 +55,23 @@ public class PwdTelnetTest { } @Test - public void testService() throws RemotingException { + void testService() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService"); String result = pwdTelnet.execute(mockCommandContext, new String[0]); assertEquals("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService", result); } @Test - public void testSlash() throws RemotingException { + void testSlash() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(null); String result = pwdTelnet.execute(mockCommandContext, new String[0]); assertEquals("/", result); } @Test - public void testMessageError() throws RemotingException { + void testMessageError() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(null); String result = pwdTelnet.execute(mockCommandContext, new String[]{"test"}); assertEquals("Unsupported parameter [test] for pwd.", result); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/QuitTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/QuitTest.java index fb9a1512e8..ba12a8b2a5 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/QuitTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/QuitTest.java @@ -25,11 +25,11 @@ import org.mockito.Mockito; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class QuitTest { +class QuitTest { @Test - public void testExecute() throws Exception { + void testExecute() throws Exception { Quit quit = new Quit(); String output = quit.execute(Mockito.mock(CommandContext.class), null); assertThat(output, equalTo(QosConstants.CLOSE)); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ReadyTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ReadyTest.java index 40dd4fda2a..07a6bb9f82 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ReadyTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ReadyTest.java @@ -41,7 +41,7 @@ import java.util.Collections; import java.util.List; import java.util.Optional; -public class ReadyTest { +class ReadyTest { private FrameworkModel frameworkModel; private ModuleDeployer moduleDeployer; @@ -76,7 +76,7 @@ public class ReadyTest { } @Test - public void testExecute() { + void testExecute() { Ready ready = new Ready(frameworkModel); CommandContext commandContext = new CommandContext("ready"); @@ -89,4 +89,4 @@ public class ReadyTest { Assertions.assertEquals("false", result); Assertions.assertEquals(commandContext.getHttpCode(), 503); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/SelectTelnetTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/SelectTelnetTest.java index c52a1e5bd1..4fc5f7d649 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/SelectTelnetTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/SelectTelnetTest.java @@ -42,7 +42,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; -public class SelectTelnetTest { +class SelectTelnetTest { private BaseCommand select; @@ -78,7 +78,7 @@ public class SelectTelnetTest { } @Test - public void testInvokeWithoutMethodList() throws RemotingException { + void testInvokeWithoutMethodList() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(DemoService.class.getName()); defaultAttributeMap.attr(InvokeTelnet.INVOKE_METHOD_LIST_KEY).set(null); @@ -95,7 +95,7 @@ public class SelectTelnetTest { } @Test - public void testInvokeWithIllegalMessage() throws RemotingException { + void testInvokeWithIllegalMessage() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(DemoService.class.getName()); defaultAttributeMap.attr(InvokeTelnet.INVOKE_METHOD_LIST_KEY).set(methods); @@ -118,7 +118,7 @@ public class SelectTelnetTest { } @Test - public void testInvokeWithNull() throws RemotingException { + void testInvokeWithNull() throws RemotingException { defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(DemoService.class.getName()); defaultAttributeMap.attr(InvokeTelnet.INVOKE_METHOD_LIST_KEY).set(methods); @@ -144,4 +144,4 @@ public class SelectTelnetTest { null ); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ShutdownTelnetTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ShutdownTelnetTest.java index a724b75f87..dcaf89fb6b 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ShutdownTelnetTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/ShutdownTelnetTest.java @@ -31,7 +31,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; -public class ShutdownTelnetTest { +class ShutdownTelnetTest { private BaseCommand shutdown; private Channel mockChannel; @@ -52,13 +52,13 @@ public class ShutdownTelnetTest { } @Test - public void testInvoke() throws RemotingException { + void testInvoke() throws RemotingException { String result = shutdown.execute(mockCommandContext, new String[0]); assertTrue(result.contains("Application has shutdown successfully")); } @Test - public void testInvokeWithTimeParameter() throws RemotingException { + void testInvokeWithTimeParameter() throws RemotingException { int sleepTime = 2000; long start = System.currentTimeMillis(); String result = shutdown.execute(mockCommandContext, new String[]{"-t", "" + sleepTime}); @@ -66,4 +66,4 @@ public class ShutdownTelnetTest { assertTrue(result.contains("Application has shutdown successfully"), result); assertTrue((end - start) >= sleepTime, "sleepTime: " + sleepTime + ", execTime: " + (end - start)); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/StartupTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/StartupTest.java index 80eebb9b22..845f95e5fc 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/StartupTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/StartupTest.java @@ -38,7 +38,7 @@ import java.util.Arrays; import java.util.List; import java.util.Optional; -public class StartupTest { +class StartupTest { private FrameworkModel frameworkModel; private ModuleDeployer moduleDeployer; @@ -67,7 +67,7 @@ public class StartupTest { } @Test - public void testExecute() { + void testExecute() { Startup startup = new Startup(frameworkModel); CommandContext commandContext = new CommandContext("startup"); @@ -80,4 +80,4 @@ public class StartupTest { Assertions.assertEquals("false", result); Assertions.assertEquals(commandContext.getHttpCode(), 503); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/CommandHelperTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/CommandHelperTest.java index 1021f267b1..191c65e235 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/CommandHelperTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/CommandHelperTest.java @@ -65,17 +65,17 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CommandHelperTest { +class CommandHelperTest { private CommandHelper commandHelper = new CommandHelper(FrameworkModel.defaultModel()); @Test - public void testHasCommand() throws Exception { + void testHasCommand() throws Exception { assertTrue(commandHelper.hasCommand("greeting")); assertFalse(commandHelper.hasCommand("not-exiting")); } @Test - public void testGetAllCommandClass() throws Exception { + void testGetAllCommandClass() throws Exception { List> classes = commandHelper.getAllCommandClass(); // update this list when introduce a new command @@ -119,8 +119,8 @@ public class CommandHelperTest { } @Test - public void testGetCommandClass() throws Exception { + void testGetCommandClass() throws Exception { assertThat(commandHelper.getCommandClass("greeting"), equalTo(GreetingCommand.class)); assertNull(commandHelper.getCommandClass("not-exiting")); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/ServiceCheckUtilsTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/ServiceCheckUtilsTest.java index 432e02536f..90cbc0f769 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/ServiceCheckUtilsTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/util/ServiceCheckUtilsTest.java @@ -47,12 +47,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test for ServiceCheckUtils */ -public class ServiceCheckUtilsTest { +class ServiceCheckUtilsTest { private final ModuleServiceRepository repository = ApplicationModel.defaultModel().getDefaultModule().getServiceRepository(); @Test - public void testIsRegistered() { + void testIsRegistered() { DemoService demoServiceImpl = new DemoServiceImpl(); int availablePort = NetUtils.getAvailablePort(); @@ -77,7 +77,7 @@ public class ServiceCheckUtilsTest { } @Test - public void testGetConsumerAddressNum() { + void testGetConsumerAddressNum() { ConsumerModel consumerModel = Mockito.mock(ConsumerModel.class); ServiceMetadata serviceMetadata = Mockito.mock(ServiceMetadata.class); Mockito.when(consumerModel.getServiceMetadata()).thenReturn(serviceMetadata); @@ -144,4 +144,4 @@ public class ServiceCheckUtilsTest { } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/ChangeTelnetHandlerTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/ChangeTelnetHandlerTest.java index 1592f3d31b..e42fce162d 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/ChangeTelnetHandlerTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/ChangeTelnetHandlerTest.java @@ -40,7 +40,7 @@ import static org.mockito.Mockito.reset; /** * ChangeTelnetHandlerTest.java */ -public class ChangeTelnetHandlerTest { +class ChangeTelnetHandlerTest { private static TelnetHandler change = new ChangeTelnetHandler(); private Channel mockChannel; @@ -80,14 +80,14 @@ public class ChangeTelnetHandlerTest { } @Test - public void testChangeSimpleName() throws RemotingException { + void testChangeSimpleName() throws RemotingException { ExtensionLoader.getExtensionLoader(Protocol.class).getExtension(DubboProtocol.NAME).export(mockInvoker); String result = change.telnet(mockChannel, "DemoService"); assertEquals("Used the DemoService as default.\r\nYou can cancel default service by command: cd /", result); } @Test - public void testChangeName() throws RemotingException { + void testChangeName() throws RemotingException { ExtensionLoader.getExtensionLoader(Protocol.class).getExtension(DubboProtocol.NAME).export(mockInvoker); String result = change.telnet(mockChannel, "org.apache.dubbo.qos.legacy.service.DemoService"); assertEquals("Used the org.apache.dubbo.qos.legacy.service.DemoService as default.\r\nYou can cancel default service by command: cd /", @@ -95,33 +95,33 @@ public class ChangeTelnetHandlerTest { } @Test - public void testChangePath() throws RemotingException { + void testChangePath() throws RemotingException { ExtensionLoader.getExtensionLoader(Protocol.class).getExtension(DubboProtocol.NAME).export(mockInvoker); String result = change.telnet(mockChannel, "demo"); assertEquals("Used the demo as default.\r\nYou can cancel default service by command: cd /", result); } @Test - public void testChangeMessageNull() throws RemotingException { + void testChangeMessageNull() throws RemotingException { String result = change.telnet(mockChannel, null); assertEquals("Please input service name, eg: \r\ncd XxxService\r\ncd com.xxx.XxxService", result); } @Test - public void testChangeServiceNotExport() throws RemotingException { + void testChangeServiceNotExport() throws RemotingException { String result = change.telnet(mockChannel, "demo"); assertEquals("No such service demo", result); } @Test - public void testChangeCancel() throws RemotingException { + void testChangeCancel() throws RemotingException { String result = change.telnet(mockChannel, ".."); assertEquals("Cancelled default service org.apache.dubbo.rpc.protocol.dubbo.support.DemoService.", result); } @Test - public void testChangeCancel2() throws RemotingException { + void testChangeCancel2() throws RemotingException { String result = change.telnet(mockChannel, "/"); assertEquals("Cancelled default service org.apache.dubbo.rpc.protocol.dubbo.support.DemoService.", result); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/LogTelnetHandlerTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/LogTelnetHandlerTest.java index 6417b44d2d..2bd4561a33 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/LogTelnetHandlerTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/LogTelnetHandlerTest.java @@ -28,13 +28,13 @@ import static org.mockito.Mockito.mock; /** * LogTelnetHandlerTest.java */ -public class LogTelnetHandlerTest { +class LogTelnetHandlerTest { private static TelnetHandler log = new LogTelnetHandler(); private Channel mockChannel; @Test - public void testChangeLogLevel() throws RemotingException { + void testChangeLogLevel() throws RemotingException { mockChannel = mock(Channel.class); String result = log.telnet(mockChannel, "error"); @@ -44,11 +44,11 @@ public class LogTelnetHandlerTest { } @Test - public void testPrintLog() throws RemotingException { + void testPrintLog() throws RemotingException { mockChannel = mock(Channel.class); String result = log.telnet(mockChannel, "100"); assertTrue(result.contains("CURRENT LOG APPENDER")); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/TraceTelnetHandlerTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/TraceTelnetHandlerTest.java index e3b0389ea5..8c0adeb65a 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/TraceTelnetHandlerTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/TraceTelnetHandlerTest.java @@ -40,7 +40,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; -public class TraceTelnetHandlerTest { +class TraceTelnetHandlerTest { private TelnetHandler handler; private Channel mockChannel; @@ -63,7 +63,7 @@ public class TraceTelnetHandlerTest { } @Test - public void testTraceTelnetAddTracer() throws Exception { + void testTraceTelnetAddTracer() throws Exception { String method = "sayHello"; String message = "org.apache.dubbo.qos.legacy.service.DemoService sayHello 1"; Class type = DemoService.class; @@ -82,4 +82,4 @@ public class TraceTelnetHandlerTest { Assertions.assertTrue(channels.contains(mockChannel)); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/service/generic/GenericServiceTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/service/generic/GenericServiceTest.java index c2a98e6cd8..ba19263480 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/service/generic/GenericServiceTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/service/generic/GenericServiceTest.java @@ -50,10 +50,10 @@ import static org.apache.dubbo.common.constants.CommonConstants.GENERIC_SERIALIZ * GenericServiceTest */ @Disabled("Keeps failing on Travis, but can not be reproduced locally.") -public class GenericServiceTest { +class GenericServiceTest { @Test - public void testGenericServiceException() { + void testGenericServiceException() { ServiceConfig service = new ServiceConfig(); service.setInterface(DemoService.class.getName()); service.setRef(new GenericService() { @@ -109,7 +109,7 @@ public class GenericServiceTest { @SuppressWarnings("unchecked") @Test - public void testGenericReferenceException() { + void testGenericReferenceException() { ServiceConfig service = new ServiceConfig(); service.setInterface(DemoService.class.getName()); service.setRef(new DemoServiceImpl()); @@ -146,7 +146,7 @@ public class GenericServiceTest { } @Test - public void testGenericSerializationJava() throws Exception { + void testGenericSerializationJava() throws Exception { ServiceConfig service = new ServiceConfig(); service.setInterface(DemoService.class.getName()); DemoServiceImpl ref = new DemoServiceImpl(); @@ -216,7 +216,7 @@ public class GenericServiceTest { } @Test - public void testGenericInvokeWithBeanSerialization() throws Exception { + void testGenericInvokeWithBeanSerialization() throws Exception { ServiceConfig service = new ServiceConfig(); service.setInterface(DemoService.class); DemoServiceImpl impl = new DemoServiceImpl(); @@ -256,7 +256,7 @@ public class GenericServiceTest { } @Test - public void testGenericImplementationWithBeanSerialization() throws Exception { + void testGenericImplementationWithBeanSerialization() throws Exception { final AtomicReference reference = new AtomicReference(); ServiceConfig service = new ServiceConfig(); @@ -332,4 +332,4 @@ public class GenericServiceTest { Object[] arguments; } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/protocol/QosProtocolWrapperTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/protocol/QosProtocolWrapperTest.java index 05f1eddeac..da6f5c4663 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/protocol/QosProtocolWrapperTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/protocol/QosProtocolWrapperTest.java @@ -23,6 +23,7 @@ import org.apache.dubbo.qos.server.Server; import org.apache.dubbo.rpc.Invoker; import org.apache.dubbo.rpc.Protocol; import org.apache.dubbo.rpc.model.FrameworkModel; + import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -39,7 +40,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class QosProtocolWrapperTest { +class QosProtocolWrapperTest { private URL url = Mockito.mock(URL.class); private Invoker invoker = mock(Invoker.class); private Protocol protocol = mock(Protocol.class); @@ -87,7 +88,7 @@ public class QosProtocolWrapperTest { } @Test - public void testExport() throws Exception { + void testExport() throws Exception { wrapper.export(invoker); assertThat(server.isStarted(), is(true)); assertThat(server.getHost(), is("localhost")); @@ -97,7 +98,7 @@ public class QosProtocolWrapperTest { } @Test - public void testRefer() throws Exception { + void testRefer() throws Exception { wrapper.refer(BaseCommand.class, url); assertThat(server.isStarted(), is(true)); assertThat(server.getHost(), is("localhost")); @@ -107,7 +108,7 @@ public class QosProtocolWrapperTest { } @Test - public void testMultiProtocol() throws Exception { + void testMultiProtocol() throws Exception { //tri protocol start first, acceptForeignIp = true triWrapper.export(triInvoker); assertThat(server.isStarted(), is(true)); diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/HttpProcessHandlerTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/HttpProcessHandlerTest.java index d9a9bf8c63..84745ca830 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/HttpProcessHandlerTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/HttpProcessHandlerTest.java @@ -35,9 +35,9 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class HttpProcessHandlerTest { +class HttpProcessHandlerTest { @Test - public void test1() throws Exception { + void test1() throws Exception { ChannelHandlerContext context = mock(ChannelHandlerContext.class); ChannelFuture future = mock(ChannelFuture.class); when(context.writeAndFlush(any(FullHttpResponse.class))).thenReturn(future); @@ -53,7 +53,7 @@ public class HttpProcessHandlerTest { } @Test - public void test2() throws Exception { + void test2() throws Exception { ChannelHandlerContext context = mock(ChannelHandlerContext.class); ChannelFuture future = mock(ChannelFuture.class); when(context.writeAndFlush(any(FullHttpResponse.class))).thenReturn(future); @@ -70,7 +70,7 @@ public class HttpProcessHandlerTest { } @Test - public void test3() throws Exception { + void test3() throws Exception { ChannelHandlerContext context = mock(ChannelHandlerContext.class); ChannelFuture future = mock(ChannelFuture.class); when(context.writeAndFlush(any(FullHttpResponse.class))).thenReturn(future); @@ -85,4 +85,4 @@ public class HttpProcessHandlerTest { FullHttpResponse response = captor.getValue(); assertThat(response.status().code(), equalTo(404)); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/LocalHostPermitHandlerTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/LocalHostPermitHandlerTest.java index ee2f0501c2..9d11d080e8 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/LocalHostPermitHandlerTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/LocalHostPermitHandlerTest.java @@ -34,9 +34,9 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class LocalHostPermitHandlerTest { +class LocalHostPermitHandlerTest { @Test - public void testHandlerAdded() throws Exception { + void testHandlerAdded() throws Exception { ChannelHandlerContext context = mock(ChannelHandlerContext.class); Channel channel = mock(Channel.class); when(context.channel()).thenReturn(channel); @@ -53,4 +53,4 @@ public class LocalHostPermitHandlerTest { assertThat(new String(captor.getValue().array()), containsString("Foreign Ip Not Permitted")); verify(future).addListener(ChannelFutureListener.CLOSE); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/QosProcessHandlerTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/QosProcessHandlerTest.java index 271a27784d..0ba4909a01 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/QosProcessHandlerTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/QosProcessHandlerTest.java @@ -35,9 +35,9 @@ import java.util.Collections; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; -public class QosProcessHandlerTest { +class QosProcessHandlerTest { @Test - public void testDecodeHttp() throws Exception { + void testDecodeHttp() throws Exception { ByteBuf buf = Unpooled.wrappedBuffer(new byte[] {'G'}); ChannelHandlerContext context = Mockito.mock(ChannelHandlerContext.class); ChannelPipeline pipeline = Mockito.mock(ChannelPipeline.class); @@ -51,7 +51,7 @@ public class QosProcessHandlerTest { } @Test - public void testDecodeTelnet() throws Exception { + void testDecodeTelnet() throws Exception { ByteBuf buf = Unpooled.wrappedBuffer(new byte[] {'A'}); ChannelHandlerContext context = Mockito.mock(ChannelHandlerContext.class); ChannelPipeline pipeline = Mockito.mock(ChannelPipeline.class); @@ -66,4 +66,4 @@ public class QosProcessHandlerTest { } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/TelnetProcessHandlerTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/TelnetProcessHandlerTest.java index 759d664b39..3a256f877d 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/TelnetProcessHandlerTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/server/handler/TelnetProcessHandlerTest.java @@ -32,9 +32,9 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class TelnetProcessHandlerTest { +class TelnetProcessHandlerTest { @Test - public void testPrompt() throws Exception { + void testPrompt() throws Exception { ChannelHandlerContext context = mock(ChannelHandlerContext.class); TelnetProcessHandler handler = new TelnetProcessHandler(FrameworkModel.defaultModel()); handler.channelRead0(context, ""); @@ -42,7 +42,7 @@ public class TelnetProcessHandlerTest { } @Test - public void testBye() throws Exception { + void testBye() throws Exception { ChannelHandlerContext context = mock(ChannelHandlerContext.class); TelnetProcessHandler handler = new TelnetProcessHandler(FrameworkModel.defaultModel()); ChannelFuture future = mock(ChannelFuture.class); @@ -52,7 +52,7 @@ public class TelnetProcessHandlerTest { } @Test - public void testUnknownCommand() throws Exception { + void testUnknownCommand() throws Exception { ChannelHandlerContext context = mock(ChannelHandlerContext.class); TelnetProcessHandler handler = new TelnetProcessHandler(FrameworkModel.defaultModel()); handler.channelRead0(context, "unknown"); @@ -62,7 +62,7 @@ public class TelnetProcessHandlerTest { } @Test - public void testGreeting() throws Exception { + void testGreeting() throws Exception { ChannelHandlerContext context = mock(ChannelHandlerContext.class); TelnetProcessHandler handler = new TelnetProcessHandler(FrameworkModel.defaultModel()); handler.channelRead0(context, "greeting"); @@ -71,4 +71,4 @@ public class TelnetProcessHandlerTest { assertThat(captor.getValue(), containsString("greeting")); assertThat(captor.getValue(), containsString("dubbo>")); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TKvTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TKvTest.java index 6c584035e6..dc9d5d60ba 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TKvTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TKvTest.java @@ -21,9 +21,9 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; -public class TKvTest { +class TKvTest { @Test - public void test1() { + void test1() { TKv tKv = new TKv(new TTable.ColumnDefine(TTable.Align.RIGHT), new TTable.ColumnDefine(10, false, TTable.Align.LEFT)); tKv.add("KEY-1", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); tKv.add("KEY-2", "1234567890"); @@ -48,7 +48,7 @@ public class TKvTest { } @Test - public void test2() throws Exception { + void test2() throws Exception { TKv tKv = new TKv(); tKv.add("KEY-1", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); tKv.add("KEY-2", "1234567890"); @@ -57,4 +57,4 @@ public class TKvTest { assertThat(kv, containsString("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); System.out.println(kv); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TLadderTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TLadderTest.java index 16355c8c4a..319f84379b 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TLadderTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TLadderTest.java @@ -21,9 +21,9 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class TLadderTest { +class TLadderTest { @Test - public void testRendering() throws Exception { + void testRendering() throws Exception { TLadder ladder = new TLadder(); ladder.addItem("1"); ladder.addItem("2"); @@ -37,4 +37,4 @@ public class TLadderTest { assertThat(result, equalTo(expected)); System.out.println(result); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTableTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTableTest.java index b70128a629..7a83be62f4 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTableTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTableTest.java @@ -21,9 +21,9 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class TTableTest { +class TTableTest { @Test - public void test1() throws Exception { + void test1() throws Exception { TTable table = new TTable(4); table.addRow(1, "one", "uno", "un"); table.addRow(2, "two", "dos", "deux"); @@ -38,7 +38,7 @@ public class TTableTest { } @Test - public void test2() throws Exception { + void test2() throws Exception { TTable table = new TTable(new TTable.ColumnDefine[]{ new TTable.ColumnDefine(5, true, TTable.Align.LEFT), new TTable.ColumnDefine(10, false, TTable.Align.MIDDLE), @@ -52,4 +52,4 @@ public class TTableTest { assertThat(result, equalTo(expected)); System.out.println(result); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTreeTest.java b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTreeTest.java index c4a28bb054..d990d244ee 100644 --- a/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTreeTest.java +++ b/dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/textui/TTreeTest.java @@ -21,9 +21,9 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -public class TTreeTest { +class TTreeTest { @Test - public void test() throws Exception { + void test() throws Exception { TTree tree = new TTree(false, "root"); tree.begin("one").begin("ONE").end().end(); tree.begin("two").begin("TWO").end().begin("2").end().end(); @@ -39,4 +39,4 @@ public class TTreeTest { assertThat(result, equalTo(expected)); System.out.println(result); } -} +} \ No newline at end of file diff --git a/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/ManyToManyMethodHandlerTest.java b/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/ManyToManyMethodHandlerTest.java index bf80ca94ec..b1c642967b 100644 --- a/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/ManyToManyMethodHandlerTest.java +++ b/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/ManyToManyMethodHandlerTest.java @@ -20,6 +20,7 @@ package org.apache.dubbo.reactive; import org.apache.dubbo.common.stream.StreamObserver; import org.apache.dubbo.reactive.handler.ManyToManyMethodHandler; import org.apache.dubbo.rpc.protocol.tri.observer.ServerCallToObserverAdapter; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -38,7 +39,7 @@ import static org.mockito.Mockito.doAnswer; public final class ManyToManyMethodHandlerTest { @Test - public void testInvoke() throws ExecutionException, InterruptedException { + void testInvoke() throws ExecutionException, InterruptedException { AtomicInteger nextCounter = new AtomicInteger(); AtomicInteger completeCounter = new AtomicInteger(); AtomicInteger errorCounter = new AtomicInteger(); diff --git a/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/ManyToOneMethodHandlerTest.java b/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/ManyToOneMethodHandlerTest.java index e3e3302c7b..1a5953fad1 100644 --- a/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/ManyToOneMethodHandlerTest.java +++ b/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/ManyToOneMethodHandlerTest.java @@ -20,6 +20,7 @@ package org.apache.dubbo.reactive; import org.apache.dubbo.common.stream.StreamObserver; import org.apache.dubbo.reactive.handler.ManyToOneMethodHandler; import org.apache.dubbo.rpc.protocol.tri.observer.ServerCallToObserverAdapter; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -38,7 +39,7 @@ import static org.mockito.Mockito.doAnswer; public final class ManyToOneMethodHandlerTest { @Test - public void testInvoker() throws ExecutionException, InterruptedException { + void testInvoker() throws ExecutionException, InterruptedException { AtomicInteger nextCounter = new AtomicInteger(); AtomicInteger completeCounter = new AtomicInteger(); AtomicInteger errorCounter = new AtomicInteger(); @@ -63,7 +64,7 @@ public final class ManyToOneMethodHandlerTest { } @Test - public void testError() throws ExecutionException, InterruptedException { + void testError() throws ExecutionException, InterruptedException { AtomicInteger nextCounter = new AtomicInteger(); AtomicInteger completeCounter = new AtomicInteger(); AtomicInteger errorCounter = new AtomicInteger(); diff --git a/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/OneToManyMethodHandlerTest.java b/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/OneToManyMethodHandlerTest.java index ac0c8d975f..f1cdeb6f65 100644 --- a/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/OneToManyMethodHandlerTest.java +++ b/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/OneToManyMethodHandlerTest.java @@ -19,6 +19,7 @@ package org.apache.dubbo.reactive; import org.apache.dubbo.reactive.handler.OneToManyMethodHandler; import org.apache.dubbo.rpc.protocol.tri.observer.ServerCallToObserverAdapter; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -37,7 +38,7 @@ import static org.mockito.Mockito.doAnswer; public final class OneToManyMethodHandlerTest { @Test - public void testInvoke() { + void testInvoke() { String request = "1,2,3,4,5,6,7"; AtomicInteger nextCounter = new AtomicInteger(); AtomicInteger completeCounter = new AtomicInteger(); @@ -59,7 +60,7 @@ public final class OneToManyMethodHandlerTest { } @Test - public void testError() { + void testError() { String request = "1,2,3,4,5,6,7"; AtomicInteger nextCounter = new AtomicInteger(); AtomicInteger completeCounter = new AtomicInteger(); diff --git a/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/OneToOneMethodHandlerTest.java b/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/OneToOneMethodHandlerTest.java index 6d6a2fcde8..22e1d42ec5 100644 --- a/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/OneToOneMethodHandlerTest.java +++ b/dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/OneToOneMethodHandlerTest.java @@ -18,6 +18,7 @@ package org.apache.dubbo.reactive; import org.apache.dubbo.reactive.handler.OneToOneMethodHandler; + import org.junit.jupiter.api.Test; import java.util.concurrent.CompletableFuture; @@ -31,7 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public final class OneToOneMethodHandlerTest { @Test - public void testInvoke() throws ExecutionException, InterruptedException { + void testInvoke() throws ExecutionException, InterruptedException { String request = "request"; OneToOneMethodHandler handler = new OneToOneMethodHandler<>(requestMono -> requestMono.map(r -> r + "Test")); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ListenerRegistryWrapperTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ListenerRegistryWrapperTest.java index 1d9c21455d..363adec7fa 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ListenerRegistryWrapperTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ListenerRegistryWrapperTest.java @@ -36,10 +36,10 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class ListenerRegistryWrapperTest { +class ListenerRegistryWrapperTest { @Test - public void testSubscribe() { + void testSubscribe() { Map parameters = new HashMap<>(); parameters.put(INTERFACE_KEY, DemoService.class.getName()); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/PerformanceRegistryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/PerformanceRegistryTest.java index ce8b8643b5..a4dca95b0c 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/PerformanceRegistryTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/PerformanceRegistryTest.java @@ -28,12 +28,12 @@ import org.junit.jupiter.api.Test; * RegistryPerformanceTest * */ -public class PerformanceRegistryTest { +class PerformanceRegistryTest { private static final Logger logger = LoggerFactory.getLogger(PerformanceRegistryTest.class); @Test - public void testRegistry() { + void testRegistry() { // read server info from property if (PerformanceUtils.getProperty("server", null) == null) { logger.warn("Please set -Dserver=127.0.0.1:9090"); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/RegistryFactoryWrapperTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/RegistryFactoryWrapperTest.java index cc797438b4..c87b31c750 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/RegistryFactoryWrapperTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/RegistryFactoryWrapperTest.java @@ -23,11 +23,11 @@ import org.apache.dubbo.common.extension.ExtensionLoader; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class RegistryFactoryWrapperTest { +class RegistryFactoryWrapperTest { private RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension(); @Test - public void test() throws Exception { + void test() throws Exception { RegistryServiceListener listener1 = Mockito.mock(RegistryServiceListener.class); RegistryServiceListener1.delegate = listener1; RegistryServiceListener listener2 = Mockito.mock(RegistryServiceListener.class); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/AbstractServiceDiscoveryFactoryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/AbstractServiceDiscoveryFactoryTest.java index c15f086da0..65b39fc83a 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/AbstractServiceDiscoveryFactoryTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/AbstractServiceDiscoveryFactoryTest.java @@ -28,10 +28,10 @@ import java.util.List; /** * {@link AbstractServiceDiscoveryFactory} */ -public class AbstractServiceDiscoveryFactoryTest { +class AbstractServiceDiscoveryFactoryTest { @Test - public void testGetServiceDiscoveryWithCache() { + void testGetServiceDiscoveryWithCache() { ApplicationModel.defaultModel().getApplicationConfigManager().setApplication(new ApplicationConfig("AbstractServiceDiscoveryFactoryTest")); URL url = URL.valueOf("mock://127.0.0.1:8888"); ServiceDiscoveryFactory factory = ServiceDiscoveryFactory.getExtension(url); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/DefaultServiceInstanceTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/DefaultServiceInstanceTest.java index ea33a98477..11c618d651 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/DefaultServiceInstanceTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/DefaultServiceInstanceTest.java @@ -37,7 +37,7 @@ import static org.junit.jupiter.api.Assertions.assertNotSame; * * @since 2.7.5 */ -public class DefaultServiceInstanceTest { +class DefaultServiceInstanceTest { public DefaultServiceInstance instance; @@ -61,7 +61,7 @@ public class DefaultServiceInstanceTest { } @Test - public void testSetAndGetValues() { + void testSetAndGetValues() { instance.setEnabled(false); instance.setHealthy(false); @@ -74,7 +74,7 @@ public class DefaultServiceInstanceTest { } @Test - public void testInstanceOperations() { + void testInstanceOperations() { // test multiple protocols assertEquals(2, instance.getEndpoints().size()); DefaultServiceInstance.Endpoint endpoint = getEndpoint(instance, "rest"); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/InstanceAddressURLTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/InstanceAddressURLTest.java index 15442b29fd..1667dba8e0 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/InstanceAddressURLTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/InstanceAddressURLTest.java @@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class InstanceAddressURLTest { +class InstanceAddressURLTest { private static URL url = URL.valueOf("dubbo://30.225.21.30:20880/org.apache.dubbo.registry.service.DemoService?" + "REGISTRY_CLUSTER=registry1&anyhost=true&application=demo-provider2&delay=1000&deprecated=false&dubbo=2.0.2" + "&dynamic=true&generic=false&group=greeting&interface=org.apache.dubbo.registry.service.DemoService" + @@ -113,7 +113,7 @@ public class InstanceAddressURLTest { } @Test - public void test1() { + void test1() { // test reading of keys in instance and metadata work fine assertEquals("value1", instanceURL.getParameter("key1"));//return instance key assertNull(instanceURL.getParameter("delay"));// no service key specified @@ -169,7 +169,7 @@ public class InstanceAddressURLTest { } @Test - public void test2() { + void test2() { RpcServiceContext.getServiceContext().setConsumerUrl(null); Assertions.assertNull(instanceURL.getScopeModel()); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryTest.java index 32d774a6e0..92a24d35e3 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryTest.java @@ -61,7 +61,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class ServiceDiscoveryRegistryTest { +class ServiceDiscoveryRegistryTest { public static final String APP_NAME1 = "app1"; public static final String APP_NAME2 = "app2"; public static final String APP_NAME3 = "app3"; @@ -122,7 +122,7 @@ public class ServiceDiscoveryRegistryTest { * - check=false */ @Test - public void testDoSubscribe() { + void testDoSubscribe() { ApplicationModel applicationModel = spy(ApplicationModel.defaultModel()); when(applicationModel.getDefaultExtension(ServiceNameMapping.class)).thenReturn(mapping); // Exceptional case, no interface-app mapping found @@ -180,7 +180,7 @@ public class ServiceDiscoveryRegistryTest { * - instance listener and service listener rightly mapped */ @Test - public void testSubscribeURLs() { + void testSubscribeURLs() { // interface to single app mapping Set singleApp = new TreeSet<>(); singleApp.add(APP_NAME1); @@ -240,12 +240,12 @@ public class ServiceDiscoveryRegistryTest { * repeat of {@link this#testSubscribeURLs()} with multi threads */ @Test - public void testConcurrencySubscribe() { + void testConcurrencySubscribe() { // TODO } @Test - public void testUnsubscribe() { + void testUnsubscribe() { // do subscribe to prepare for unsubscribe verification Set multiApps = new TreeSet<>(); multiApps.add(APP_NAME1); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListenerTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListenerTest.java index f7f5ead9f7..cc2a11a17f 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListenerTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListenerTest.java @@ -73,7 +73,7 @@ import static org.mockito.Mockito.when; * @since 2.7.5 */ @TestMethodOrder(MethodOrderer.OrderAnnotation.class) -public class ServiceInstancesChangedListenerTest { +class ServiceInstancesChangedListenerTest { static List app1Instances; static List app2Instances; diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/MetadataServiceNameMappingTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/MetadataServiceNameMappingTest.java index 3f096fd930..36bd64a49e 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/MetadataServiceNameMappingTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/MetadataServiceNameMappingTest.java @@ -48,7 +48,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; -public class MetadataServiceNameMappingTest { +class MetadataServiceNameMappingTest { private MetadataServiceNameMapping mapping; private URL url; @@ -74,7 +74,7 @@ public class MetadataServiceNameMappingTest { } @Test - public void testMap() { + void testMap() { ApplicationModel mockedApplicationModel = spy(applicationModel); when(configManager.getMetadataConfigs()).thenReturn(Collections.emptyList()); @@ -123,7 +123,7 @@ public class MetadataServiceNameMappingTest { * This test currently doesn't make any sense */ @Test - public void testGet() { + void testGet() { Set set = new HashSet<>(); set.add("app1"); @@ -140,7 +140,7 @@ public class MetadataServiceNameMappingTest { * Same situation as testGet, so left empty. */ @Test - public void testGetAndListen() { + void testGetAndListen() { // TODO } } diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/MetadataServiceURLBuilderTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/MetadataServiceURLBuilderTest.java index 1dd2d98eb7..4a59066288 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/MetadataServiceURLBuilderTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/MetadataServiceURLBuilderTest.java @@ -25,7 +25,7 @@ import org.apache.dubbo.rpc.model.ApplicationModel; * * @since 2.7.5 */ -public class MetadataServiceURLBuilderTest { +class MetadataServiceURLBuilderTest { static ServiceInstance serviceInstance = new DefaultServiceInstance("test", "127.0.0.1", 8080, ApplicationModel.defaultModel()); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/ProtocolPortsMetadataCustomizerTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/ProtocolPortsMetadataCustomizerTest.java index f0ba7cb82f..d5bf6ba89e 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/ProtocolPortsMetadataCustomizerTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/ProtocolPortsMetadataCustomizerTest.java @@ -41,7 +41,7 @@ import static org.hamcrest.Matchers.hasProperty; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -public class ProtocolPortsMetadataCustomizerTest { +class ProtocolPortsMetadataCustomizerTest { public DefaultServiceInstance instance; private MetadataService mockedMetadataService; @@ -80,7 +80,7 @@ public class ProtocolPortsMetadataCustomizerTest { } @Test - public void test() { + void test() { ProtocolPortsMetadataCustomizer customizer = new ProtocolPortsMetadataCustomizer(); customizer.customize(instance, ApplicationModel.defaultModel()); String endpoints = instance.getMetadata().get(ENDPOINTS); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataCustomizerTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataCustomizerTest.java index 01d77c06a0..81362c384f 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataCustomizerTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataCustomizerTest.java @@ -31,7 +31,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.spy; -public class ServiceInstanceMetadataCustomizerTest { +class ServiceInstanceMetadataCustomizerTest { private static ServiceInstanceMetadataCustomizer serviceInstanceMetadataCustomizer; @BeforeAll @@ -49,7 +49,7 @@ public class ServiceInstanceMetadataCustomizerTest { * Only 'include' policy spicified in Customized Filter will take effect */ @Test - public void testCustomizeWithIncludeFilters() { + void testCustomizeWithIncludeFilters() { ApplicationModel applicationModel = spy(ApplicationModel.defaultModel()); ApplicationConfig applicationConfig = new ApplicationConfig("aa"); doReturn(applicationConfig).when(applicationModel).getCurrentConfig(); @@ -69,7 +69,7 @@ public class ServiceInstanceMetadataCustomizerTest { * Only 'exclude' policies specified in Exclude Filters will take effect */ @Test - public void testCustomizeWithExcludeFilters() { + void testCustomizeWithExcludeFilters() { ApplicationModel applicationModel = spy(ApplicationModel.defaultModel()); ApplicationConfig applicationConfig = new ApplicationConfig("aa"); doReturn(applicationConfig).when(applicationModel).getCurrentConfig(); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/SpringCloudMetadataServiceURLBuilderTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/SpringCloudMetadataServiceURLBuilderTest.java index 9f0395db02..91aba6b4cf 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/SpringCloudMetadataServiceURLBuilderTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/SpringCloudMetadataServiceURLBuilderTest.java @@ -32,12 +32,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * * @since 2.7.5 */ -public class SpringCloudMetadataServiceURLBuilderTest { +class SpringCloudMetadataServiceURLBuilderTest { private SpringCloudMetadataServiceURLBuilder builder = new SpringCloudMetadataServiceURLBuilder(); @Test - public void testBuild() { + void testBuild() { List urls = builder.build(new DefaultServiceInstance("127.0.0.1", "test", 8080, ApplicationModel.defaultModel())); assertEquals(0, urls.size()); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/StandardMetadataServiceURLBuilderTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/StandardMetadataServiceURLBuilderTest.java index 91350da89e..d6bd958d1f 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/StandardMetadataServiceURLBuilderTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/StandardMetadataServiceURLBuilderTest.java @@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * {@link StandardMetadataServiceURLBuilder} Test */ -public class StandardMetadataServiceURLBuilderTest { +class StandardMetadataServiceURLBuilderTest { @BeforeAll public static void setUp() { @@ -50,7 +50,7 @@ public class StandardMetadataServiceURLBuilderTest { } @Test - public void testBuild() { + void testBuild() { ExtensionLoader loader = ApplicationModel.defaultModel() .getExtensionLoader(MetadataServiceURLBuilder.class); MetadataServiceURLBuilder builder = loader.getExtension(StandardMetadataServiceURLBuilder.NAME); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/store/MetaCacheManagerTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/store/MetaCacheManagerTest.java index daa5ff4264..f8dc8ca82a 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/store/MetaCacheManagerTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/store/MetaCacheManagerTest.java @@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.fail; -public class MetaCacheManagerTest { +class MetaCacheManagerTest { @BeforeEach public void setup() throws URISyntaxException { @@ -50,7 +50,7 @@ public class MetaCacheManagerTest { } @Test - public void testCache() { + void testCache() { // ScheduledExecutorService cacheRefreshExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("Dubbo-cache-refresh")); // ExecutorRepository executorRepository = Mockito.mock(ExecutorRepository.class); // when(executorRepository.getCacheRefreshExecutor()).thenReturn(cacheRefreshExecutor); @@ -85,7 +85,7 @@ public class MetaCacheManagerTest { @Test - public void testCacheDump() { + void testCacheDump() { System.setProperty("dubbo.meta.cache.fileName", "not-exist.dubbo.cache"); MetadataInfo metadataInfo3 = JsonUtils.getJson().toJavaObject("{\"app\":\"demo3\",\"services\":{\"greeting/org.apache.dubbo.registry.service.DemoService2:1.0.0:dubbo\":{\"name\":\"org.apache.dubbo.registry.service.DemoService2\",\"group\":\"greeting\",\"version\":\"1.0.0\",\"protocol\":\"dubbo\",\"path\":\"org.apache.dubbo.registry.service.DemoService2\",\"params\":{\"application\":\"demo-provider2\",\"sayHello.timeout\":\"7000\",\"version\":\"1.0.0\",\"timeout\":\"5000\",\"group\":\"greeting\"}},\"greeting/org.apache.dubbo.registry.service.DemoService:1.0.0:dubbo\":{\"name\":\"org.apache.dubbo.registry.service.DemoService\",\"group\":\"greeting\",\"version\":\"1.0.0\",\"protocol\":\"dubbo\",\"path\":\"org.apache.dubbo.registry.service.DemoService\",\"params\":{\"application\":\"demo-provider2\",\"version\":\"1.0.0\",\"timeout\":\"5000\",\"group\":\"greeting\"}}}}\n", MetadataInfo.class); MetaCacheManager cacheManager = new MetaCacheManager(); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparatorTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparatorTest.java index 0314ff7ed2..b6c43baa2c 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparatorTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparatorTest.java @@ -33,10 +33,10 @@ import java.util.List; import static org.apache.dubbo.registry.client.migration.DefaultMigrationAddressComparator.NEW_ADDRESS_SIZE; import static org.apache.dubbo.registry.client.migration.DefaultMigrationAddressComparator.OLD_ADDRESS_SIZE; -public class DefaultMigrationAddressComparatorTest { +class DefaultMigrationAddressComparatorTest { @Test - public void test() { + void test() { DefaultMigrationAddressComparator comparator = new DefaultMigrationAddressComparator(); ClusterInvoker newInvoker = Mockito.mock(ClusterInvoker.class); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationInvokerTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationInvokerTest.java index dee3ca5e2d..5bed016013 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationInvokerTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationInvokerTest.java @@ -39,7 +39,7 @@ import org.mockito.Mockito; import java.util.LinkedList; import java.util.List; -public class MigrationInvokerTest { +class MigrationInvokerTest { @BeforeEach public void before() { FrameworkModel.destroyAll(); @@ -55,7 +55,7 @@ public class MigrationInvokerTest { } @Test - public void test() { + void test() { RegistryProtocol registryProtocol = Mockito.mock(RegistryProtocol.class); ClusterInvoker invoker = Mockito.mock(ClusterInvoker.class); @@ -226,7 +226,7 @@ public class MigrationInvokerTest { } @Test - public void testDecide() { + void testDecide() { RegistryProtocol registryProtocol = Mockito.mock(RegistryProtocol.class); ClusterInvoker invoker = Mockito.mock(ClusterInvoker.class); @@ -286,7 +286,7 @@ public class MigrationInvokerTest { } @Test - public void testConcurrency() { + void testConcurrency() { // 独立线程 // 独立线程invoker状态切换 diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationRuleHandlerTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationRuleHandlerTest.java index b5ae5dd8c1..a98a4f4385 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationRuleHandlerTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationRuleHandlerTest.java @@ -25,9 +25,9 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class MigrationRuleHandlerTest { +class MigrationRuleHandlerTest { @Test - public void test() { + void test() { MigrationClusterInvoker invoker = Mockito.mock(MigrationClusterInvoker.class); URL url = Mockito.mock(URL.class); Mockito.when(url.getDisplayServiceKey()).thenReturn("test"); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationRuleListenerTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationRuleListenerTest.java index 72a0775fc1..9a31e66ea4 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationRuleListenerTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/MigrationRuleListenerTest.java @@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; -public class MigrationRuleListenerTest { +class MigrationRuleListenerTest { private String localRule = "key: demo-consumer\n" + "step: APPLICATION_FIRST\n" + @@ -75,7 +75,7 @@ public class MigrationRuleListenerTest { * Check local rule take effect */ @Test - public void test() throws InterruptedException { + void test() throws InterruptedException { DynamicConfiguration dynamicConfiguration = Mockito.mock(DynamicConfiguration.class); ApplicationModel.reset(); @@ -110,7 +110,7 @@ public class MigrationRuleListenerTest { * Test listener started without local rule and config center, INIT should be used and no scheduled task should be started. */ @Test - public void testWithInitAndNoLocalRule() { + void testWithInitAndNoLocalRule() { ApplicationModel.defaultModel().getDefaultModule().getModelEnvironment().setDynamicConfiguration(null); ApplicationModel.defaultModel().getDefaultModule().getModelEnvironment().setLocalMigrationRule(""); ApplicationConfig applicationConfig = new ApplicationConfig(); @@ -145,7 +145,7 @@ public class MigrationRuleListenerTest { * 2. remote rule change and all invokers gets notified */ @Test - public void testWithConfigurationListenerAndLocalRule() throws InterruptedException { + void testWithConfigurationListenerAndLocalRule() throws InterruptedException { DynamicConfiguration dynamicConfiguration = Mockito.mock(DynamicConfiguration.class); Mockito.doReturn(remoteRule).when(dynamicConfiguration).getConfig(Mockito.anyString(), Mockito.anyString()); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/model/MigrationRuleTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/model/MigrationRuleTest.java index 0194ec5bfb..79b20de724 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/model/MigrationRuleTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/migration/model/MigrationRuleTest.java @@ -35,11 +35,11 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class MigrationRuleTest { +class MigrationRuleTest { private static ServiceNameMapping mapping = mock(ServiceNameMapping.class); @Test - public void test_parse() { + void test_parse() { when(mapping.getMapping(any(URL.class))).thenReturn(Collections.emptySet()); String rule = "key: demo-consumer\n" + diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/integration/DynamicDirectoryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/integration/DynamicDirectoryTest.java index 485f1a3940..f181de31b2 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/integration/DynamicDirectoryTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/integration/DynamicDirectoryTest.java @@ -40,13 +40,13 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -public class DynamicDirectoryTest { +class DynamicDirectoryTest { /** * verify simplified consumer url information that needs to be registered */ @Test - public void testSimplifiedUrl() { + void testSimplifiedUrl() { // verify that the consumer url information that needs to be registered is not simplified by default Map parameters = new HashMap<>(); @@ -112,7 +112,7 @@ public class DynamicDirectoryTest { @Test - public void testSubscribe() { + void testSubscribe() { Map parameters = new HashMap<>(); parameters.put(INTERFACE_KEY, DemoService.class.getName()); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/integration/RegistryProtocolTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/integration/RegistryProtocolTest.java index c1eb5da4f6..a4669373d9 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/integration/RegistryProtocolTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/integration/RegistryProtocolTest.java @@ -64,7 +64,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class RegistryProtocolTest { +class RegistryProtocolTest { @AfterEach public void tearDown() throws IOException { @@ -76,7 +76,7 @@ public class RegistryProtocolTest { * verify the generated consumer url information */ @Test - public void testConsumerUrlWithoutProtocol() { + void testConsumerUrlWithoutProtocol() { ApplicationConfig applicationConfig = new ApplicationConfig(); applicationConfig.setName("application1"); @@ -143,7 +143,7 @@ public class RegistryProtocolTest { * verify that when the protocol is configured, the protocol of consumer url is the configured protocol */ @Test - public void testConsumerUrlWithProtocol() { + void testConsumerUrlWithProtocol() { ApplicationConfig applicationConfig = new ApplicationConfig(); applicationConfig.setName("application1"); @@ -214,7 +214,7 @@ public class RegistryProtocolTest { * @see FailoverCluster */ @Test - public void testReferWithoutGroup() { + void testReferWithoutGroup() { ApplicationConfig applicationConfig = new ApplicationConfig(); applicationConfig.setName("application1"); @@ -275,7 +275,7 @@ public class RegistryProtocolTest { * @see MergeableCluster */ @Test - public void testReferWithGroup() { + void testReferWithGroup() { ApplicationConfig applicationConfig = new ApplicationConfig(); applicationConfig.setName("application1"); @@ -340,7 +340,7 @@ public class RegistryProtocolTest { * @see MigrationRuleListener */ @Test - public void testInterceptInvokerForMigrationRuleListener() { + void testInterceptInvokerForMigrationRuleListener() { ApplicationConfig applicationConfig = new ApplicationConfig(); applicationConfig.setName("application1"); @@ -405,7 +405,7 @@ public class RegistryProtocolTest { * @see CountRegistryProtocolListener */ @Test - public void testInterceptInvokerForCustomRegistryProtocolListener() { + void testInterceptInvokerForCustomRegistryProtocolListener() { ApplicationConfig applicationConfig = new ApplicationConfig(); applicationConfig.setName("application1"); @@ -468,7 +468,7 @@ public class RegistryProtocolTest { * verify the registered consumer url */ @Test - public void testRegisterConsumerUrl() { + void testRegisterConsumerUrl() { ApplicationConfig applicationConfig = new ApplicationConfig(); applicationConfig.setName("application1"); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java index 6347b78602..ae66edc2cf 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java @@ -33,7 +33,7 @@ import java.util.List; /** * AbstractRegistryFactoryTest */ -public class AbstractRegistryFactoryTest { +class AbstractRegistryFactoryTest { private AbstractRegistryFactory registryFactory; @@ -91,7 +91,7 @@ public class AbstractRegistryFactoryTest { } @Test - public void testRegistryFactoryCache() throws Exception { + void testRegistryFactoryCache() throws Exception { URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostAddress() + ":2233"); Registry registry1 = registryFactory.getRegistry(url); Registry registry2 = registryFactory.getRegistry(url); @@ -109,14 +109,14 @@ public class AbstractRegistryFactoryTest { } @Test - public void testRegistryFactoryGroupCache() throws Exception { + void testRegistryFactoryGroupCache() throws Exception { Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa")); Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb")); Assertions.assertNotSame(registry1, registry2); } @Test - public void testDestroyAllRegistries() { + void testDestroyAllRegistries() { Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":8888?group=xxx")); Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":9999?group=yyy")); Registry registry3 = new AbstractRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2020?group=yyy")) { diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java index 79d937942c..ce7ddd2690 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java @@ -40,7 +40,7 @@ import static org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL /** * AbstractRegistryTest */ -public class AbstractRegistryTest { +class AbstractRegistryTest { private URL testUrl; private URL mockUrl; @@ -93,7 +93,7 @@ public class AbstractRegistryTest { * @throws Exception */ @Test - public void testRegister() throws Exception { + void testRegister() throws Exception { //test one url abstractRegistry.register(mockUrl); assert abstractRegistry.getRegistered().contains(mockUrl); @@ -109,7 +109,7 @@ public class AbstractRegistryTest { } @Test - public void testRegisterIfURLNULL() { + void testRegisterIfURLNULL() { Assertions.assertThrows(IllegalArgumentException.class, () -> { abstractRegistry.register(null); Assertions.fail("register url == null"); @@ -122,7 +122,7 @@ public class AbstractRegistryTest { * */ @Test - public void testUnregister() { + void testUnregister() { //test one unregister URL url = new ServiceConfigURL("dubbo", "192.168.0.1", 2200); abstractRegistry.register(url); @@ -143,7 +143,7 @@ public class AbstractRegistryTest { } @Test - public void testUnregisterIfUrlNull() { + void testUnregisterIfUrlNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { abstractRegistry.unregister(null); Assertions.fail("unregister url == null"); @@ -154,7 +154,7 @@ public class AbstractRegistryTest { * test subscribe and unsubscribe */ @Test - public void testSubscribeAndUnsubscribe() { + void testSubscribeAndUnsubscribe() { //test subscribe final AtomicReference notified = new AtomicReference(false); NotifyListener listener = urls -> notified.set(Boolean.TRUE); @@ -169,7 +169,7 @@ public class AbstractRegistryTest { } @Test - public void testSubscribeIfUrlNull() { + void testSubscribeIfUrlNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { final AtomicReference notified = new AtomicReference(false); NotifyListener listener = urls -> notified.set(Boolean.TRUE); @@ -180,7 +180,7 @@ public class AbstractRegistryTest { } @Test - public void testSubscribeIfListenerNull() { + void testSubscribeIfListenerNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { final AtomicReference notified = new AtomicReference(false); NotifyListener listener = urls -> notified.set(Boolean.TRUE); @@ -191,7 +191,7 @@ public class AbstractRegistryTest { } @Test - public void testUnsubscribeIfUrlNull() { + void testUnsubscribeIfUrlNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { final AtomicReference notified = new AtomicReference(false); NotifyListener listener = urls -> notified.set(Boolean.TRUE); @@ -201,7 +201,7 @@ public class AbstractRegistryTest { } @Test - public void testUnsubscribeIfNotifyNull() { + void testUnsubscribeIfNotifyNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { final AtomicReference notified = new AtomicReference(false); URL url = new ServiceConfigURL("dubbo", "192.168.0.1", 2200); @@ -216,7 +216,7 @@ public class AbstractRegistryTest { * */ @Test - public void testSubscribe() { + void testSubscribe() { // check parameters try { abstractRegistry.subscribe(testUrl, null); @@ -244,7 +244,7 @@ public class AbstractRegistryTest { * */ @Test - public void testUnsubscribe() { + void testUnsubscribe() { // check parameters try { abstractRegistry.unsubscribe(testUrl, null); @@ -274,7 +274,7 @@ public class AbstractRegistryTest { * {@link org.apache.dubbo.registry.support.AbstractRegistry#recover()}. */ @Test - public void testRecover() throws Exception { + void testRecover() throws Exception { // test recover nothing abstractRegistry.recover(); Assertions.assertFalse(abstractRegistry.getRegistered().contains(testUrl)); @@ -292,7 +292,7 @@ public class AbstractRegistryTest { } @Test - public void testRecover2() throws Exception { + void testRecover2() throws Exception { List list = getList(); abstractRegistry.recover(); Assertions.assertEquals(0, abstractRegistry.getRegistered().size()); @@ -309,7 +309,7 @@ public class AbstractRegistryTest { * {@link org.apache.dubbo.registry.support.AbstractRegistry#notify(List)}. */ @Test - public void testNotify() { + void testNotify() { final AtomicReference notified = new AtomicReference(false); NotifyListener listener1 = urls -> notified.set(Boolean.TRUE); URL url1 = new ServiceConfigURL("dubbo", "192.168.0.1", 2200, parametersConsumer); @@ -335,7 +335,7 @@ public class AbstractRegistryTest { * test notifyList */ @Test - public void testNotifyList() { + void testNotifyList() { final AtomicReference notified = new AtomicReference(false); NotifyListener listener1 = urls -> notified.set(Boolean.TRUE); URL url1 = new ServiceConfigURL("dubbo", "192.168.0.1", 2200, parametersConsumer); @@ -358,7 +358,7 @@ public class AbstractRegistryTest { } @Test - public void testNotifyIfURLNull() { + void testNotifyIfURLNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { final AtomicReference notified = new AtomicReference(false); NotifyListener listener1 = urls -> notified.set(Boolean.TRUE); @@ -380,7 +380,7 @@ public class AbstractRegistryTest { } @Test - public void testNotifyIfNotifyNull() { + void testNotifyIfNotifyNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { final AtomicReference notified = new AtomicReference(false); NotifyListener listener1 = urls -> notified.set(Boolean.TRUE); @@ -408,7 +408,7 @@ public class AbstractRegistryTest { * */ @Test - public void testNotifyArgs() { + void testNotifyArgs() { // check parameters try { abstractRegistry.notify(null, null, null); @@ -444,7 +444,7 @@ public class AbstractRegistryTest { } @Test - public void filterEmptyTest() { + void filterEmptyTest() { // check parameters try { AbstractRegistry.filterEmpty(null, null); @@ -477,7 +477,7 @@ public class AbstractRegistryTest { @Test - public void lookupTest() { + void lookupTest() { // loop up before registry try { abstractRegistry.lookup(null); @@ -497,7 +497,7 @@ public class AbstractRegistryTest { } @Test - public void destroyTest() { + void destroyTest() { abstractRegistry.register(testUrl); abstractRegistry.subscribe(testUrl, listener); Assertions.assertEquals(1, abstractRegistry.getRegistered().size()); @@ -509,7 +509,7 @@ public class AbstractRegistryTest { } @Test - public void allTest() { + void allTest() { // test all methods List urls = new ArrayList<>(); urls.add(testUrl); @@ -539,7 +539,7 @@ public class AbstractRegistryTest { } @Test - public void getCacheUrlsTest() { + void getCacheUrlsTest() { List urls = new ArrayList<>(); urls.add(testUrl); // check if notify successfully diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/FailbackRegistryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/FailbackRegistryTest.java index 391a80e97b..b63ae3f1e6 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/FailbackRegistryTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/FailbackRegistryTest.java @@ -34,7 +34,7 @@ import static org.apache.dubbo.registry.Constants.CONSUMER_PROTOCOL; import static org.apache.dubbo.registry.Constants.REGISTRY_RETRY_PERIOD_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; -public class FailbackRegistryTest { +class FailbackRegistryTest { protected final Logger logger = LoggerFactory.getLogger(getClass()); private URL serviceUrl; @@ -60,7 +60,7 @@ public class FailbackRegistryTest { * @throws Exception */ @Test - public void testDoRetry() throws Exception { + void testDoRetry() throws Exception { final AtomicReference notified = new AtomicReference(false); @@ -95,7 +95,7 @@ public class FailbackRegistryTest { } @Test - public void testDoRetryRegister() throws Exception { + void testDoRetryRegister() throws Exception { final CountDownLatch latch = new CountDownLatch(1);//All of them are called 4 times. A successful attempt to lose 1. subscribe will not be done @@ -115,7 +115,7 @@ public class FailbackRegistryTest { } @Test - public void testDoRetrySubscribe() throws Exception { + void testDoRetrySubscribe() throws Exception { final AtomicReference notified = new AtomicReference(false); final CountDownLatch latch = new CountDownLatch(1);//All of them are called 4 times. A successful attempt to lose 1. subscribe will not be done @@ -143,7 +143,7 @@ public class FailbackRegistryTest { } @Test - public void testRecover() throws Exception { + void testRecover() throws Exception { CountDownLatch countDownLatch = new CountDownLatch(6); final AtomicReference notified = new AtomicReference(false); NotifyListener listener = urls -> notified.set(Boolean.TRUE); diff --git a/dubbo-registry/dubbo-registry-multicast/src/test/java/org/apache/dubbo/registry/multicast/MulticastRegistryFactoryTest.java b/dubbo-registry/dubbo-registry-multicast/src/test/java/org/apache/dubbo/registry/multicast/MulticastRegistryFactoryTest.java index c2f5520bc6..8f0c7a5df5 100644 --- a/dubbo-registry/dubbo-registry-multicast/src/test/java/org/apache/dubbo/registry/multicast/MulticastRegistryFactoryTest.java +++ b/dubbo-registry/dubbo-registry-multicast/src/test/java/org/apache/dubbo/registry/multicast/MulticastRegistryFactoryTest.java @@ -26,9 +26,9 @@ import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; -public class MulticastRegistryFactoryTest { +class MulticastRegistryFactoryTest { @Test - public void shouldCreateRegistry() { + void shouldCreateRegistry() { Registry registry = new MulticastRegistryFactory().createRegistry(URL.valueOf("multicast://239.255.255.255/")); assertThat(registry, not(nullValue())); assertThat(registry.isAvailable(), is(true)); diff --git a/dubbo-registry/dubbo-registry-multiple/src/test/java/org/apache/dubbo/registry/multiple/MultipleRegistry2S2RTest.java b/dubbo-registry/dubbo-registry-multiple/src/test/java/org/apache/dubbo/registry/multiple/MultipleRegistry2S2RTest.java index dfa04ecae8..4d16b2d600 100644 --- a/dubbo-registry/dubbo-registry-multiple/src/test/java/org/apache/dubbo/registry/multiple/MultipleRegistry2S2RTest.java +++ b/dubbo-registry/dubbo-registry-multiple/src/test/java/org/apache/dubbo/registry/multiple/MultipleRegistry2S2RTest.java @@ -34,7 +34,7 @@ import java.util.List; /** * 2019-04-30 */ -public class MultipleRegistry2S2RTest { +class MultipleRegistry2S2RTest { private static final String SERVICE_NAME = "org.apache.dubbo.registry.MultipleService2S2R"; private static final String SERVICE2_NAME = "org.apache.dubbo.registry.MultipleService2S2R2"; @@ -68,7 +68,7 @@ public class MultipleRegistry2S2RTest { } @Test - public void testParamConfig() { + void testParamConfig() { Assertions.assertEquals(2, multipleRegistry.origReferenceRegistryURLs.size()); Assertions.assertTrue(multipleRegistry.origReferenceRegistryURLs.contains(zookeeperConnectionAddress1)); @@ -107,7 +107,7 @@ public class MultipleRegistry2S2RTest { } @Test - public void testRegistryAndUnRegistry() throws InterruptedException { + void testRegistryAndUnRegistry() throws InterruptedException { URL serviceUrl = URL.valueOf("http2://multiple/" + SERVICE_NAME + "?notify=false&methods=test1,test2&category=providers"); // URL serviceUrl2 = URL.valueOf("http2://multiple2/" + SERVICE_NAME + "?notify=false&methods=test1,test2&category=providers"); multipleRegistry.register(serviceUrl); @@ -138,7 +138,7 @@ public class MultipleRegistry2S2RTest { } @Test - public void testSubscription() throws InterruptedException { + void testSubscription() throws InterruptedException { URL serviceUrl = URL.valueOf("http2://multiple/" + SERVICE2_NAME + "?notify=false&methods=test1,test2&category=providers"); // URL serviceUrl2 = URL.valueOf("http2://multiple2/" + SERVICE_NAME + "?notify=false&methods=test1,test2&category=providers"); multipleRegistry.register(serviceUrl); @@ -176,7 +176,7 @@ public class MultipleRegistry2S2RTest { } @Test - public void testAggregation() { + void testAggregation() { List result = new ArrayList(); List listToAggregate = new ArrayList(); URL url1= URL.valueOf("dubbo://127.0.0.1:20880/service1"); diff --git a/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosRegistryFactoryTest.java b/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosRegistryFactoryTest.java index effabf2193..1df7d4d760 100644 --- a/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosRegistryFactoryTest.java +++ b/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosRegistryFactoryTest.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test; /** * Test for NacosRegistryFactory */ -public class NacosRegistryFactoryTest { +class NacosRegistryFactoryTest { private NacosRegistryFactory nacosRegistryFactory; @@ -41,7 +41,7 @@ public class NacosRegistryFactoryTest { } @Test - public void testCreateRegistryCacheKey() { + void testCreateRegistryCacheKey() { URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostAddress() + ":8080"); String registryCacheKey1 = nacosRegistryFactory.createRegistryCacheKey(url); String registryCacheKey2 = nacosRegistryFactory.createRegistryCacheKey(url); @@ -49,7 +49,7 @@ public class NacosRegistryFactoryTest { } @Test - public void testCreateRegistryCacheKeyWithNamespace() { + void testCreateRegistryCacheKeyWithNamespace() { URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostAddress() + ":8080?namespace=test"); String registryCacheKey1 = nacosRegistryFactory.createRegistryCacheKey(url); String registryCacheKey2 = nacosRegistryFactory.createRegistryCacheKey(url); diff --git a/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosRegistryTest.java b/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosRegistryTest.java index 839bedc81d..1acb68981a 100644 --- a/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosRegistryTest.java +++ b/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosRegistryTest.java @@ -51,7 +51,7 @@ import static org.mockito.Mockito.when; /** * Test for NacosRegistry */ -public class NacosRegistryTest { +class NacosRegistryTest { private static final String serviceInterface = "org.apache.dubbo.registry.nacos.NacosService"; @@ -83,7 +83,7 @@ public class NacosRegistryTest { } @Test - public void testRegister() { + void testRegister() { NamingService namingService = mock(NacosNamingService.class); try { @@ -118,7 +118,7 @@ public class NacosRegistryTest { } @Test - public void testUnRegister() { + void testUnRegister() { NamingService namingService = mock(NacosNamingService.class); try { @@ -158,7 +158,7 @@ public class NacosRegistryTest { } @Test - public void testSubscribe() { + void testSubscribe() { NamingService namingService = mock(NacosNamingService.class); try { @@ -195,7 +195,7 @@ public class NacosRegistryTest { } @Test - public void testUnSubscribe() { + void testUnSubscribe() { NamingService namingService = mock(NacosNamingService.class); try { @@ -240,7 +240,7 @@ public class NacosRegistryTest { @Test - public void testIsConformRules() { + void testIsConformRules() { NamingService namingService = mock(NacosNamingService.class); URL serviceUrlWithoutCategory = URL.valueOf("nacos://127.0.0.1:3333/" + serviceInterface + "?interface=" + serviceInterface + "¬ify=false&methods=test1,test2&version=1.0.0&group=default"); diff --git a/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosServiceDiscoveryFactoryTest.java b/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosServiceDiscoveryFactoryTest.java index a8d1c11ec6..c52466d9a6 100644 --- a/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosServiceDiscoveryFactoryTest.java +++ b/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosServiceDiscoveryFactoryTest.java @@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test; /** * Test for NacosServiceDiscoveryFactory */ -public class NacosServiceDiscoveryFactoryTest { +class NacosServiceDiscoveryFactoryTest { private NacosServiceDiscoveryFactory nacosServiceDiscoveryFactory; @@ -41,7 +41,7 @@ public class NacosServiceDiscoveryFactoryTest { } @Test - public void testGetServiceDiscoveryWithCache() { + void testGetServiceDiscoveryWithCache() { URL url = URL.valueOf("dubbo://test:8080"); ServiceDiscovery discovery = nacosServiceDiscoveryFactory.createDiscovery(url); diff --git a/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosServiceDiscoveryTest.java b/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosServiceDiscoveryTest.java index 87f8cd1399..962acca8af 100644 --- a/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosServiceDiscoveryTest.java +++ b/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/NacosServiceDiscoveryTest.java @@ -57,7 +57,7 @@ import static org.mockito.Mockito.when; /** * Test for NacosServiceDiscovery */ -public class NacosServiceDiscoveryTest { +class NacosServiceDiscoveryTest { private static final String SERVICE_NAME = "NACOS_SERVICE"; @@ -132,7 +132,7 @@ public class NacosServiceDiscoveryTest { } @Test - public void testDoRegister() throws NacosException { + void testDoRegister() throws NacosException { DefaultServiceInstance serviceInstance = createServiceInstance(SERVICE_NAME, LOCALHOST, NetUtils.getAvailablePort()); // register nacosServiceDiscovery.doRegister(serviceInstance); @@ -147,7 +147,7 @@ public class NacosServiceDiscoveryTest { } @Test - public void testDoUnRegister() throws NacosException { + void testDoUnRegister() throws NacosException { // register DefaultServiceInstance serviceInstance = createServiceInstance(SERVICE_NAME, LOCALHOST, NetUtils.getAvailablePort()); // register @@ -166,7 +166,7 @@ public class NacosServiceDiscoveryTest { } @Test - public void testGetServices() throws NacosException { + void testGetServices() throws NacosException { DefaultServiceInstance serviceInstance = createServiceInstance(SERVICE_NAME, LOCALHOST, NetUtils.getAvailablePort()); // register nacosServiceDiscovery.doRegister(serviceInstance); @@ -187,7 +187,7 @@ public class NacosServiceDiscoveryTest { } @Test - public void testAddServiceInstancesChangedListener() { + void testAddServiceInstancesChangedListener() { List serviceInstances = new LinkedList<>(); // Add Listener nacosServiceDiscovery.addServiceInstancesChangedListener( diff --git a/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtilsTest.java b/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtilsTest.java index fc8203590b..701d97cffa 100644 --- a/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtilsTest.java +++ b/dubbo-registry/dubbo-registry-nacos/src/test/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtilsTest.java @@ -34,18 +34,18 @@ import static org.mockito.Mockito.mock; /** * Test for NacosNamingServiceUtils */ -public class NacosNamingServiceUtilsTest { +class NacosNamingServiceUtilsTest { private static MetadataReport metadataReport = Mockito.mock(MetadataReport.class); @Test - public void testToInstance() { + void testToInstance() { ServiceInstance serviceInstance = mock(ServiceInstance.class); Instance instance = NacosNamingServiceUtils.toInstance(serviceInstance); Assertions.assertNotNull(instance); } @Test - public void testToServiceInstance() { + void testToServiceInstance() { URL registryUrl = URL.valueOf("test://test:8080/test"); Instance instance = new Instance(); instance.setServiceName("serviceName"); @@ -66,7 +66,7 @@ public class NacosNamingServiceUtilsTest { } @Test - public void testCreateNamingService() { + void testCreateNamingService() { URL url = URL.valueOf("test://test:8080/test?backup=backup"); NacosNamingServiceWrapper namingService = NacosNamingServiceUtils.createNamingService(url); Assertions.assertNotNull(namingService); diff --git a/dubbo-registry/dubbo-registry-zookeeper/src/test/java/org/apache/dubbo/registry/zookeeper/ZookeeperRegistryTest.java b/dubbo-registry/dubbo-registry-zookeeper/src/test/java/org/apache/dubbo/registry/zookeeper/ZookeeperRegistryTest.java index c1e58cd0c8..3f36ad395b 100644 --- a/dubbo-registry/dubbo-registry-zookeeper/src/test/java/org/apache/dubbo/registry/zookeeper/ZookeeperRegistryTest.java +++ b/dubbo-registry/dubbo-registry-zookeeper/src/test/java/org/apache/dubbo/registry/zookeeper/ZookeeperRegistryTest.java @@ -43,7 +43,7 @@ import static org.hamcrest.Matchers.containsString; import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.Mockito.mock; -public class ZookeeperRegistryTest { +class ZookeeperRegistryTest { private static String zookeeperConnectionAddress1; private ZookeeperRegistry zookeeperRegistry; private String service = "org.apache.dubbo.test.injvmServie"; @@ -66,7 +66,7 @@ public class ZookeeperRegistryTest { } @Test - public void testAnyHost() { + void testAnyHost() { Assertions.assertThrows(IllegalStateException.class, () -> { URL errorUrl = URL.valueOf("multicast://0.0.0.0/"); new ZookeeperRegistryFactory(ApplicationModel.defaultModel()).createRegistry(errorUrl); @@ -74,7 +74,7 @@ public class ZookeeperRegistryTest { } @Test - public void testRegister() { + void testRegister() { Set registered; for (int i = 0; i < 2; i++) { @@ -88,7 +88,7 @@ public class ZookeeperRegistryTest { } @Test - public void testSubscribe() { + void testSubscribe() { NotifyListener listener = mock(NotifyListener.class); zookeeperRegistry.subscribe(serviceUrl, listener); @@ -103,7 +103,7 @@ public class ZookeeperRegistryTest { } @Test - public void testAvailable() { + void testAvailable() { zookeeperRegistry.register(serviceUrl); assertThat(zookeeperRegistry.isAvailable(), is(true)); @@ -112,7 +112,7 @@ public class ZookeeperRegistryTest { } @Test - public void testLookup() { + void testLookup() { List lookup = zookeeperRegistry.lookup(serviceUrl); assertThat(lookup.size(), is(1)); @@ -122,7 +122,7 @@ public class ZookeeperRegistryTest { } @Test - public void testLookupIllegalUrl() { + void testLookupIllegalUrl() { try { zookeeperRegistry.lookup(null); fail(); @@ -133,7 +133,7 @@ public class ZookeeperRegistryTest { } @Test - public void testLookupWithException() { + void testLookupWithException() { URL errorUrl = URL.valueOf("multicast://0.0.0.0/"); Assertions.assertThrows(RpcException.class, () -> zookeeperRegistry.lookup(errorUrl)); } @@ -161,7 +161,7 @@ public class ZookeeperRegistryTest { } @Test - public void testSubscribeAnyValue() throws InterruptedException { + void testSubscribeAnyValue() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); zookeeperRegistry.register(serviceUrl); zookeeperRegistry.subscribe(anyUrl, urls -> latch.countDown()); @@ -170,14 +170,14 @@ public class ZookeeperRegistryTest { } @Test - public void testDestroy() { + void testDestroy() { zookeeperRegistry.destroy(); assertThat(zookeeperRegistry.isAvailable(), is(false)); } @Test - public void testDoRegisterWithException() { + void testDoRegisterWithException() { Assertions.assertThrows(RpcException.class, () -> { URL errorUrl = URL.valueOf("multicast://0.0.0.0/"); zookeeperRegistry.doRegister(errorUrl); @@ -185,7 +185,7 @@ public class ZookeeperRegistryTest { } @Test - public void testDoUnregisterWithException() { + void testDoUnregisterWithException() { Assertions.assertThrows(RpcException.class, () -> { URL errorUrl = URL.valueOf("multicast://0.0.0.0/"); zookeeperRegistry.doUnregister(errorUrl); @@ -193,7 +193,7 @@ public class ZookeeperRegistryTest { } @Test - public void testDoSubscribeWithException() { + void testDoSubscribeWithException() { Assertions.assertThrows(RpcException.class, () -> zookeeperRegistry.doSubscribe(anyUrl, listener)); } diff --git a/dubbo-registry/dubbo-registry-zookeeper/src/test/java/org/apache/dubbo/registry/zookeeper/ZookeeperServiceDiscoveryTest.java b/dubbo-registry/dubbo-registry-zookeeper/src/test/java/org/apache/dubbo/registry/zookeeper/ZookeeperServiceDiscoveryTest.java index 2de256ec68..f3420bb596 100644 --- a/dubbo-registry/dubbo-registry-zookeeper/src/test/java/org/apache/dubbo/registry/zookeeper/ZookeeperServiceDiscoveryTest.java +++ b/dubbo-registry/dubbo-registry-zookeeper/src/test/java/org/apache/dubbo/registry/zookeeper/ZookeeperServiceDiscoveryTest.java @@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * @since 2.7.5 */ @DisabledForJreRange(min = JRE.JAVA_16) -public class ZookeeperServiceDiscoveryTest { +class ZookeeperServiceDiscoveryTest { private static final String SERVICE_NAME = "A"; @@ -78,7 +78,7 @@ public class ZookeeperServiceDiscoveryTest { } @Test - public void testRegistration() throws InterruptedException { + void testRegistration() throws InterruptedException { CountDownLatch latch = new CountDownLatch(1); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/ChanelHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/ChanelHandlerTest.java index 0045415cab..723c03a2c9 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/ChanelHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/ChanelHandlerTest.java @@ -33,7 +33,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY; *

* mvn clean test -Dtest=*PerformanceClientTest -Dserver=10.20.153.187:9911 */ -public class ChanelHandlerTest { +class ChanelHandlerTest { private static final Logger logger = LoggerFactory.getLogger(ChanelHandlerTest.class); @@ -74,7 +74,7 @@ public class ChanelHandlerTest { } @Test - public void testClient() throws Throwable { + void testClient() throws Throwable { // read server info from property if (PerformanceUtils.getProperty("server", null) == null) { logger.warn("Please set -Dserver=127.0.0.1:9911"); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientCloseTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientCloseTest.java index f81272ae3c..b15f773451 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientCloseTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientCloseTest.java @@ -33,12 +33,12 @@ import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY; * ProformanceClient * The test class will report abnormal thread pool, because the judgment on the thread pool concurrency problems produced in DefaultChannelHandler (connected event has been executed asynchronously, judgment, then closed the thread pool, thread pool and execution error, this problem can be specified through the Constants.CHANNEL_HANDLER_KEY=connection.) */ -public class PerformanceClientCloseTest { +class PerformanceClientCloseTest { private static final Logger logger = LoggerFactory.getLogger(PerformanceClientCloseTest.class); @Test - public void testClient() throws Throwable { + void testClient() throws Throwable { // read server info from property if (PerformanceUtils.getProperty("server", null) == null) { logger.warn("Please set -Dserver=127.0.0.1:9911"); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientFixedTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientFixedTest.java index 82f014099f..2474d43dd4 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientFixedTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientFixedTest.java @@ -31,12 +31,12 @@ import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT; import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY; import static org.apache.dubbo.remoting.Constants.CONNECTIONS_KEY; -public class PerformanceClientFixedTest { +class PerformanceClientFixedTest { private static final Logger logger = LoggerFactory.getLogger(PerformanceClientTest.class); @Test - public void testClient() throws Exception { + void testClient() throws Exception { // read the parameters if (PerformanceUtils.getProperty("server", null) == null) { logger.warn("Please set -Dserver=127.0.0.1:9911"); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientTest.java index d5cffb22a9..2a4579d262 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceClientTest.java @@ -42,7 +42,7 @@ import static org.apache.dubbo.remoting.Constants.CONNECTIONS_KEY; *

* mvn clean test -Dtest=*PerformanceClientTest -Dserver=10.20.153.187:9911 */ -public class PerformanceClientTest { +class PerformanceClientTest { private static final Logger logger = LoggerFactory.getLogger(PerformanceClientTest.class); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceServerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceServerTest.java index 11e378daee..1ac1af317e 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceServerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/PerformanceServerTest.java @@ -44,7 +44,7 @@ import static org.apache.dubbo.remoting.Constants.DEFAULT_BUFFER_SIZE; *

* mvn clean test -Dtest=*PerformanceServerTest -Dport=9911 */ -public class PerformanceServerTest { +class PerformanceServerTest { private static final Logger logger = LoggerFactory.getLogger(PerformanceServerTest.class); private static ExchangeServer server = null; @@ -148,7 +148,7 @@ public class PerformanceServerTest { } @Test - public void testServer() throws Exception { + void testServer() throws Exception { // Read port from property if (PerformanceUtils.getProperty("port", null) == null) { logger.warn("Please set -Dport=9911"); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/TransportersTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/TransportersTest.java index 8ebe13da12..3c5f5f4811 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/TransportersTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/TransportersTest.java @@ -22,12 +22,12 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class TransportersTest { +class TransportersTest { private String url = "dubbo://127.0.0.1:12345?transporter=mockTransporter"; private ChannelHandler channel = Mockito.mock(ChannelHandler.class); @Test - public void testBind() throws RemotingException { + void testBind() throws RemotingException { Assertions.assertThrows(RuntimeException.class, () -> Transporters.bind((String) null)); Assertions.assertThrows(RuntimeException.class, () -> Transporters.bind((URL) null)); Assertions.assertThrows(RuntimeException.class, () -> Transporters.bind(url)); @@ -36,7 +36,7 @@ public class TransportersTest { } @Test - public void testConnect() throws RemotingException { + void testConnect() throws RemotingException { Assertions.assertThrows(RuntimeException.class, () -> Transporters.connect((String) null)); Assertions.assertThrows(RuntimeException.class, () -> Transporters.connect((URL) null)); Assertions.assertNotNull(Transporters.connect(url)); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/AbstractChannelBufferTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/AbstractChannelBufferTest.java index 0f1412326f..e3232bd7c9 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/AbstractChannelBufferTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/AbstractChannelBufferTest.java @@ -66,13 +66,13 @@ public abstract class AbstractChannelBufferTest { } @Test - public void initialState() { + void initialState() { assertEquals(CAPACITY, buffer.capacity()); assertEquals(0, buffer.readerIndex()); } @Test - public void readerIndexBoundaryCheck1() { + void readerIndexBoundaryCheck1() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { try { buffer.writerIndex(0); @@ -84,7 +84,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void readerIndexBoundaryCheck2() { + void readerIndexBoundaryCheck2() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { try { buffer.writerIndex(buffer.capacity()); @@ -96,7 +96,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void readerIndexBoundaryCheck3() { + void readerIndexBoundaryCheck3() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { try { buffer.writerIndex(CAPACITY / 2); @@ -108,7 +108,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void readerIndexBoundaryCheck4() { + void readerIndexBoundaryCheck4() { buffer.writerIndex(0); buffer.readerIndex(0); buffer.writerIndex(buffer.capacity()); @@ -116,14 +116,14 @@ public abstract class AbstractChannelBufferTest { } @Test - public void writerIndexBoundaryCheck1() { + void writerIndexBoundaryCheck1() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { buffer.writerIndex(-1); }); } @Test - public void writerIndexBoundaryCheck2() { + void writerIndexBoundaryCheck2() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { try { @@ -137,7 +137,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void writerIndexBoundaryCheck3() { + void writerIndexBoundaryCheck3() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { try { buffer.writerIndex(CAPACITY); @@ -150,74 +150,74 @@ public abstract class AbstractChannelBufferTest { } @Test - public void writerIndexBoundaryCheck4() { + void writerIndexBoundaryCheck4() { buffer.writerIndex(0); buffer.readerIndex(0); buffer.writerIndex(CAPACITY); } @Test - public void getByteBoundaryCheck1() { + void getByteBoundaryCheck1() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getByte(-1)); } @Test - public void getByteBoundaryCheck2() { + void getByteBoundaryCheck2() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getByte(buffer.capacity())); } @Test - public void getByteArrayBoundaryCheck1() { + void getByteArrayBoundaryCheck1() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getBytes(-1, new byte[0])); } @Test - public void getByteArrayBoundaryCheck2() { + void getByteArrayBoundaryCheck2() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getBytes(-1, new byte[0], 0, 0)); } @Test - public void getByteBufferBoundaryCheck() { + void getByteBufferBoundaryCheck() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getBytes(-1, ByteBuffer.allocate(0))); } @Test - public void copyBoundaryCheck1() { + void copyBoundaryCheck1() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.copy(-1, 0)); } @Test - public void copyBoundaryCheck2() { + void copyBoundaryCheck2() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.copy(0, buffer.capacity() + 1)); } @Test - public void copyBoundaryCheck3() { + void copyBoundaryCheck3() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.copy(buffer.capacity() + 1, 0)); } @Test - public void copyBoundaryCheck4() { + void copyBoundaryCheck4() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.copy(buffer.capacity(), 1)); } @Test - public void setIndexBoundaryCheck1() { + void setIndexBoundaryCheck1() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.setIndex(-1, CAPACITY)); } @Test - public void setIndexBoundaryCheck2() { + void setIndexBoundaryCheck2() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.setIndex(CAPACITY / 2, CAPACITY / 4)); } @Test - public void setIndexBoundaryCheck3() { + void setIndexBoundaryCheck3() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.setIndex(0, CAPACITY + 1)); } @Test - public void getByteBufferState() { + void getByteBufferState() { ByteBuffer dst = ByteBuffer.allocate(4); dst.position(1); dst.limit(3); @@ -239,12 +239,12 @@ public abstract class AbstractChannelBufferTest { } @Test - public void getDirectByteBufferBoundaryCheck() { + void getDirectByteBufferBoundaryCheck() { Assertions.assertThrows(IndexOutOfBoundsException.class, () -> buffer.getBytes(-1, ByteBuffer.allocateDirect(0))); } @Test - public void getDirectByteBufferState() { + void getDirectByteBufferState() { ByteBuffer dst = ByteBuffer.allocateDirect(4); dst.position(1); dst.limit(3); @@ -266,7 +266,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testRandomByteAccess() { + void testRandomByteAccess() { for (int i = 0; i < buffer.capacity(); i++) { byte value = (byte) random.nextInt(); buffer.setByte(i, value); @@ -280,7 +280,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialByteAccess() { + void testSequentialByteAccess() { buffer.writerIndex(0); for (int i = 0; i < buffer.capacity(); i++) { byte value = (byte) random.nextInt(); @@ -308,7 +308,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testByteArrayTransfer() { + void testByteArrayTransfer() { byte[] value = new byte[BLOCK_SIZE * 2]; for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { random.nextBytes(value); @@ -328,7 +328,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testRandomByteArrayTransfer1() { + void testRandomByteArrayTransfer1() { byte[] value = new byte[BLOCK_SIZE]; for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { random.nextBytes(value); @@ -348,7 +348,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testRandomByteArrayTransfer2() { + void testRandomByteArrayTransfer2() { byte[] value = new byte[BLOCK_SIZE * 2]; for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { random.nextBytes(value); @@ -369,7 +369,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testRandomHeapBufferTransfer1() { + void testRandomHeapBufferTransfer1() { byte[] valueContent = new byte[BLOCK_SIZE]; ChannelBuffer value = wrappedBuffer(valueContent); for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { @@ -396,7 +396,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testRandomHeapBufferTransfer2() { + void testRandomHeapBufferTransfer2() { byte[] valueContent = new byte[BLOCK_SIZE * 2]; ChannelBuffer value = wrappedBuffer(valueContent); for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { @@ -418,7 +418,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testRandomDirectBufferTransfer() { + void testRandomDirectBufferTransfer() { byte[] tmp = new byte[BLOCK_SIZE * 2]; ChannelBuffer value = directBuffer(BLOCK_SIZE * 2); for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { @@ -441,7 +441,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testRandomByteBufferTransfer() { + void testRandomByteBufferTransfer() { ByteBuffer value = ByteBuffer.allocate(BLOCK_SIZE * 2); for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { random.nextBytes(value.array()); @@ -465,7 +465,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialByteArrayTransfer1() { + void testSequentialByteArrayTransfer1() { byte[] value = new byte[BLOCK_SIZE]; buffer.writerIndex(0); for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { @@ -489,7 +489,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialByteArrayTransfer2() { + void testSequentialByteArrayTransfer2() { byte[] value = new byte[BLOCK_SIZE * 2]; buffer.writerIndex(0); for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { @@ -515,7 +515,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialHeapBufferTransfer1() { + void testSequentialHeapBufferTransfer1() { byte[] valueContent = new byte[BLOCK_SIZE * 2]; ChannelBuffer value = wrappedBuffer(valueContent); buffer.writerIndex(0); @@ -546,7 +546,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialHeapBufferTransfer2() { + void testSequentialHeapBufferTransfer2() { byte[] valueContent = new byte[BLOCK_SIZE * 2]; ChannelBuffer value = wrappedBuffer(valueContent); buffer.writerIndex(0); @@ -582,7 +582,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialDirectBufferTransfer1() { + void testSequentialDirectBufferTransfer1() { byte[] valueContent = new byte[BLOCK_SIZE * 2]; ChannelBuffer value = directBuffer(BLOCK_SIZE * 2); buffer.writerIndex(0); @@ -615,7 +615,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialDirectBufferTransfer2() { + void testSequentialDirectBufferTransfer2() { byte[] valueContent = new byte[BLOCK_SIZE * 2]; ChannelBuffer value = directBuffer(BLOCK_SIZE * 2); buffer.writerIndex(0); @@ -654,7 +654,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialByteBufferBackedHeapBufferTransfer1() { + void testSequentialByteBufferBackedHeapBufferTransfer1() { byte[] valueContent = new byte[BLOCK_SIZE * 2]; ChannelBuffer value = wrappedBuffer(ByteBuffer.allocate(BLOCK_SIZE * 2)); value.writerIndex(0); @@ -688,7 +688,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialByteBufferBackedHeapBufferTransfer2() { + void testSequentialByteBufferBackedHeapBufferTransfer2() { byte[] valueContent = new byte[BLOCK_SIZE * 2]; ChannelBuffer value = wrappedBuffer(ByteBuffer.allocate(BLOCK_SIZE * 2)); value.writerIndex(0); @@ -728,7 +728,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialByteBufferTransfer() { + void testSequentialByteBufferTransfer() { buffer.writerIndex(0); ByteBuffer value = ByteBuffer.allocate(BLOCK_SIZE * 2); for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { @@ -753,7 +753,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSequentialCopiedBufferTransfer1() { + void testSequentialCopiedBufferTransfer1() { buffer.writerIndex(0); for (int i = 0; i < buffer.capacity() - BLOCK_SIZE + 1; i += BLOCK_SIZE) { byte[] value = new byte[BLOCK_SIZE]; @@ -779,7 +779,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testStreamTransfer1() throws Exception { + void testStreamTransfer1() throws Exception { byte[] expected = new byte[buffer.capacity()]; random.nextBytes(expected); @@ -798,7 +798,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testStreamTransfer2() throws Exception { + void testStreamTransfer2() throws Exception { byte[] expected = new byte[buffer.capacity()]; random.nextBytes(expected); buffer.clear(); @@ -821,7 +821,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testCopy() { + void testCopy() { for (int i = 0; i < buffer.capacity(); i++) { byte value = (byte) random.nextInt(); buffer.setByte(i, value); @@ -848,7 +848,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testToByteBuffer1() { + void testToByteBuffer1() { byte[] value = new byte[buffer.capacity()]; random.nextBytes(value); buffer.clear(); @@ -858,7 +858,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testToByteBuffer2() { + void testToByteBuffer2() { byte[] value = new byte[buffer.capacity()]; random.nextBytes(value); buffer.clear(); @@ -870,7 +870,7 @@ public abstract class AbstractChannelBufferTest { } @Test - public void testSkipBytes1() { + void testSkipBytes1() { buffer.setIndex(CAPACITY / 4, CAPACITY / 2); buffer.skipBytes(CAPACITY / 4); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ByteBufferBackedChannelBufferTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ByteBufferBackedChannelBufferTest.java index abf4821cfd..2d3b1f8a1b 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ByteBufferBackedChannelBufferTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ByteBufferBackedChannelBufferTest.java @@ -18,7 +18,7 @@ package org.apache.dubbo.remoting.buffer; import java.nio.ByteBuffer; -public class ByteBufferBackedChannelBufferTest extends AbstractChannelBufferTest { +class ByteBufferBackedChannelBufferTest extends AbstractChannelBufferTest { private ChannelBuffer buffer; diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBufferFactoryTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBufferFactoryTest.java index 51b5832aeb..e8c21fca8a 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBufferFactoryTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBufferFactoryTest.java @@ -25,10 +25,10 @@ import java.nio.ByteBuffer; * {@link DirectChannelBufferFactory} * {@link HeapChannelBufferFactory} */ -public class ChannelBufferFactoryTest { +class ChannelBufferFactoryTest { @Test - public void test() { + void test() { ChannelBufferFactory directChannelBufferFactory = DirectChannelBufferFactory.getInstance(); ChannelBufferFactory heapChannelBufferFactory = HeapChannelBufferFactory.getInstance(); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBufferStreamTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBufferStreamTest.java index 0b39040837..8e549b1155 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBufferStreamTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBufferStreamTest.java @@ -27,30 +27,30 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; -public class ChannelBufferStreamTest { +class ChannelBufferStreamTest { @Test - public void testChannelBufferOutputStreamWithNull() { + void testChannelBufferOutputStreamWithNull() { assertThrows(NullPointerException.class, () -> new ChannelBufferOutputStream(null)); } @Test - public void testChannelBufferInputStreamWithNull() { + void testChannelBufferInputStreamWithNull() { assertThrows(NullPointerException.class, () -> new ChannelBufferInputStream(null)); } @Test - public void testChannelBufferInputStreamWithNullAndLength() { + void testChannelBufferInputStreamWithNullAndLength() { assertThrows(NullPointerException.class, () -> new ChannelBufferInputStream(null, 0)); } @Test - public void testChannelBufferInputStreamWithBadLength() { + void testChannelBufferInputStreamWithBadLength() { assertThrows(IllegalArgumentException.class, () -> new ChannelBufferInputStream(mock(ChannelBuffer.class), -1)); } @Test - public void testChannelBufferInputStreamWithOutOfBounds() { + void testChannelBufferInputStreamWithOutOfBounds() { assertThrows(IndexOutOfBoundsException.class, () -> { ChannelBuffer buf = mock(ChannelBuffer.class); new ChannelBufferInputStream(buf, buf.capacity() + 1); @@ -58,7 +58,7 @@ public class ChannelBufferStreamTest { } @Test - public void testChannelBufferWriteOutAndReadIn() { + void testChannelBufferWriteOutAndReadIn() { ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); testChannelBufferOutputStream(buf); testChannelBufferInputStream(buf); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBuffersTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBuffersTest.java index 9e71910f9d..50e656c23c 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBuffersTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/ChannelBuffersTest.java @@ -27,9 +27,9 @@ import static org.apache.dubbo.remoting.buffer.ChannelBuffers.EMPTY_BUFFER; /** * {@link ChannelBuffers} */ -public class ChannelBuffersTest { +class ChannelBuffersTest { @Test - public void testDynamicBuffer() { + void testDynamicBuffer() { ChannelBuffer channelBuffer = ChannelBuffers.dynamicBuffer(); Assertions.assertTrue(channelBuffer instanceof DynamicChannelBuffer); Assertions.assertEquals(channelBuffer.capacity(), DEFAULT_CAPACITY); @@ -41,7 +41,7 @@ public class ChannelBuffersTest { } @Test - public void testPrefixEquals(){ + void testPrefixEquals(){ ChannelBuffer bufA = ChannelBuffers.wrappedBuffer("abcedfaf".getBytes()); ChannelBuffer bufB = ChannelBuffers.wrappedBuffer("abcedfaa".getBytes()); Assertions.assertTrue(ChannelBuffers.equals(bufA, bufB)); @@ -50,7 +50,7 @@ public class ChannelBuffersTest { } @Test - public void testBuffer() { + void testBuffer() { ChannelBuffer channelBuffer = ChannelBuffers.buffer(DEFAULT_CAPACITY); Assertions.assertTrue(channelBuffer instanceof HeapChannelBuffer); channelBuffer = ChannelBuffers.buffer(0); @@ -58,7 +58,7 @@ public class ChannelBuffersTest { } @Test - public void testWrappedBuffer() { + void testWrappedBuffer() { byte[] bytes = new byte[16]; ChannelBuffer channelBuffer = ChannelBuffers.wrappedBuffer(bytes, 0, 15); Assertions.assertTrue(channelBuffer instanceof HeapChannelBuffer); @@ -81,7 +81,7 @@ public class ChannelBuffersTest { } @Test - public void testDirectBuffer() { + void testDirectBuffer() { ChannelBuffer channelBuffer = ChannelBuffers.directBuffer(0); Assertions.assertEquals(channelBuffer, EMPTY_BUFFER); @@ -90,7 +90,7 @@ public class ChannelBuffersTest { } @Test - public void testEqualsHashCodeCompareMethod() { + void testEqualsHashCodeCompareMethod() { ChannelBuffer buffer1 = ChannelBuffers.buffer(4); byte[] bytes1 = new byte[]{1, 2, 3, 4}; buffer1.writeBytes(bytes1); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/DirectChannelBufferTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/DirectChannelBufferTest.java index 6ee7860f6b..f3d2636c74 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/DirectChannelBufferTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/DirectChannelBufferTest.java @@ -18,7 +18,7 @@ package org.apache.dubbo.remoting.buffer; import org.junit.jupiter.api.Assertions; -public class DirectChannelBufferTest extends AbstractChannelBufferTest { +class DirectChannelBufferTest extends AbstractChannelBufferTest { private ChannelBuffer buffer; diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/DynamicChannelBufferTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/DynamicChannelBufferTest.java index a59d043022..9e1e8f4ee5 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/DynamicChannelBufferTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/DynamicChannelBufferTest.java @@ -23,7 +23,7 @@ import java.util.Random; import static org.junit.jupiter.api.Assertions.assertEquals; -public class DynamicChannelBufferTest extends AbstractChannelBufferTest { +class DynamicChannelBufferTest extends AbstractChannelBufferTest { private ChannelBuffer buffer; @@ -44,24 +44,24 @@ public class DynamicChannelBufferTest extends AbstractChannelBufferTest { } @Test - public void shouldNotFailOnInitialIndexUpdate() { + void shouldNotFailOnInitialIndexUpdate() { new DynamicChannelBuffer(10).setIndex(0, 10); } @Test - public void shouldNotFailOnInitialIndexUpdate2() { + void shouldNotFailOnInitialIndexUpdate2() { new DynamicChannelBuffer(10).writerIndex(10); } @Test - public void shouldNotFailOnInitialIndexUpdate3() { + void shouldNotFailOnInitialIndexUpdate3() { ChannelBuffer buf = new DynamicChannelBuffer(10); buf.writerIndex(10); buf.readerIndex(10); } @Test - public void ensureWritableBytes() { + void ensureWritableBytes() { ChannelBuffer buf = new DynamicChannelBuffer(16); buf.ensureWritableBytes(30); Assertions.assertEquals(buf.capacity(), 32); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/HeapChannelBufferTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/HeapChannelBufferTest.java index 5ab3fcfa8c..ed62db0a96 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/HeapChannelBufferTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer/HeapChannelBufferTest.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; -public class HeapChannelBufferTest extends AbstractChannelBufferTest { +class HeapChannelBufferTest extends AbstractChannelBufferTest { private ChannelBuffer buffer; diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java index fd130bbc47..4342eb468d 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java @@ -45,7 +45,6 @@ import java.util.HashMap; import java.util.Map; import static org.apache.dubbo.common.constants.CommonConstants.READONLY_EVENT; -import static org.apache.dubbo.common.serialize.Constants.FASTJSON2_SERIALIZATION_ID; /** * @@ -128,7 +127,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Error_MagicNum() throws IOException { + void test_Decode_Error_MagicNum() throws IOException { HashMap inputBytes = new HashMap(); inputBytes.put(new byte[]{0}, TelnetCodec.DecodeResult.NEED_MORE_INPUT); inputBytes.put(new byte[]{MAGIC_HIGH, 0}, TelnetCodec.DecodeResult.NEED_MORE_INPUT); @@ -140,7 +139,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Error_Length() throws IOException { + void test_Decode_Error_Length() throws IOException { byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, SERIALIZATION_BYTE, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Person person = new Person(); byte[] request = getRequestBytes(person, header); @@ -155,7 +154,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Error_Response_Object() throws IOException { + void test_Decode_Error_Response_Object() throws IOException { //00000010-response/oneway/hearbeat=true |20-stats=ok|id=0|length=0 byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, SERIALIZATION_BYTE, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Person person = new Person(); @@ -169,7 +168,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void testInvalidSerializaitonId() throws Exception { + void testInvalidSerializaitonId() throws Exception { byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte)0x8F, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Object obj = decode(header); Assertions.assertTrue(obj instanceof Request); @@ -186,7 +185,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Check_Payload() throws IOException { + void test_Decode_Check_Payload() throws IOException { byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; byte[] request = assemblyDataProtocol(header); @@ -205,19 +204,19 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Header_Need_Readmore() throws IOException { + void test_Decode_Header_Need_Readmore() throws IOException { byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, 0, 0, 0, 0, 0, 0, 0, 0, 0}; testDecode_assertEquals(header, TelnetCodec.DecodeResult.NEED_MORE_INPUT); } @Test - public void test_Decode_Body_Need_Readmore() throws IOException { + void test_Decode_Body_Need_Readmore() throws IOException { byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 'a', 'a'}; testDecode_assertEquals(header, TelnetCodec.DecodeResult.NEED_MORE_INPUT); } @Test - public void test_Decode_MigicCodec_Contain_ExchangeHeader() throws IOException { + void test_Decode_MigicCodec_Contain_ExchangeHeader() throws IOException { byte[] header = new byte[]{0, 0, MAGIC_HIGH, MAGIC_LOW, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Channel channel = getServerSideChannel(url); @@ -229,7 +228,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Return_Response_Person() throws IOException { + void test_Decode_Return_Response_Person() throws IOException { //00000010-response/oneway/hearbeat=false/hessian |20-stats=ok|id=0|length=0 byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, SERIALIZATION_BYTE, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Person person = new Person(); @@ -252,7 +251,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Return_Request_Event_Object() throws IOException { + void test_Decode_Return_Request_Event_Object() throws IOException { //|10011111|20-stats=ok|id=0|length=0 byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) (SERIALIZATION_BYTE | (byte) 0xe0), 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Person person = new Person(); @@ -269,7 +268,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Return_Request_Event_String() throws IOException { + void test_Decode_Return_Request_Event_String() throws IOException { //|10011111|20-stats=ok|id=0|length=0 byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) (SERIALIZATION_BYTE | (byte) 0xe0), 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; String event = READONLY_EVENT; @@ -284,7 +283,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Return_Request_Heartbeat_Object() throws IOException { + void test_Decode_Return_Request_Heartbeat_Object() throws IOException { //|10011111|20-stats=ok|id=0|length=0 byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) (SERIALIZATION_BYTE | (byte) 0xe0), 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; byte[] request = getRequestBytes(null, header); @@ -297,7 +296,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Return_Request_Object() throws IOException { + void test_Decode_Return_Request_Object() throws IOException { //|10011111|20-stats=ok|id=0|length=0 byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) (SERIALIZATION_BYTE | (byte) 0xe0), 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Person person = new Person(); @@ -314,7 +313,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Decode_Error_Request_Object() throws IOException { + void test_Decode_Error_Request_Object() throws IOException { //00000010-response/oneway/hearbeat=true |20-stats=ok|id=0|length=0 byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, (byte) (SERIALIZATION_BYTE | (byte) 0xe0), 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Person person = new Person(); @@ -329,7 +328,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Header_Response_NoSerializationFlag() throws IOException { + void test_Header_Response_NoSerializationFlag() throws IOException { //00000010-response/oneway/hearbeat=false/noset |20-stats=ok|id=0|length=0 byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, SERIALIZATION_BYTE, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Person person = new Person(); @@ -342,7 +341,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Header_Response_Heartbeat() throws IOException { + void test_Header_Response_Heartbeat() throws IOException { //00000010-response/oneway/hearbeat=true |20-stats=ok|id=0|length=0 byte[] header = new byte[]{MAGIC_HIGH, MAGIC_LOW, SERIALIZATION_BYTE, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Person person = new Person(); @@ -355,7 +354,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Encode_Request() throws IOException { + void test_Encode_Request() throws IOException { ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(2014); Channel channel = getClientSideChannel(url); Request request = new Request(); @@ -376,7 +375,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Encode_Response() throws IOException { + void test_Encode_Response() throws IOException { ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(1024); Channel channel = getClientSideChannel(url); Response response = new Response(); @@ -405,7 +404,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void test_Encode_Error_Response() throws IOException { + void test_Encode_Error_Response() throws IOException { ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(1024); Channel channel = getClientSideChannel(url); Response response = new Response(); @@ -434,7 +433,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void testMessageLengthGreaterThanMessageActualLength() throws Exception { + void testMessageLengthGreaterThanMessageActualLength() throws Exception { Channel channel = getClientSideChannel(url); Request request = new Request(1L); request.setVersion(Version.getProtocolVersion()); @@ -468,7 +467,7 @@ public class ExchangeCodecTest extends TelnetCodecTest { } @Test - public void testMessageLengthExceedPayloadLimitWhenEncode() throws Exception { + void testMessageLengthExceedPayloadLimitWhenEncode() throws Exception { Request request = new Request(1L); request.setData("hello"); ChannelBuffer encodeBuffer = ChannelBuffers.dynamicBuffer(512); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/TelnetCodecTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/TelnetCodecTest.java index ff7f648947..cd0a9c5d48 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/TelnetCodecTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/TelnetCodecTest.java @@ -37,7 +37,7 @@ import java.io.Serializable; import java.util.HashMap; import java.util.Map; -public class TelnetCodecTest { +class TelnetCodecTest { protected Codec2 codec; byte[] UP = new byte[]{27, 91, 65}; byte[] DOWN = new byte[]{27, 91, 66}; @@ -189,37 +189,37 @@ public class TelnetCodecTest { } @Test - public void testDecode_String_ClientSide() throws IOException { + void testDecode_String_ClientSide() throws IOException { testDecode_assertEquals("aaa".getBytes(), "aaa", false); } @Test - public void testDecode_BlankMessage() throws IOException { + void testDecode_BlankMessage() throws IOException { testDecode_assertEquals(new byte[]{}, Codec2.DecodeResult.NEED_MORE_INPUT); } @Test - public void testDecode_String_NoEnter() throws IOException { + void testDecode_String_NoEnter() throws IOException { testDecode_assertEquals("aaa", Codec2.DecodeResult.NEED_MORE_INPUT); } @Test - public void testDecode_String_WithEnter() throws IOException { + void testDecode_String_WithEnter() throws IOException { testDecode_assertEquals("aaa\n", "aaa"); } @Test - public void testDecode_String_MiddleWithEnter() throws IOException { + void testDecode_String_MiddleWithEnter() throws IOException { testDecode_assertEquals("aaa\r\naaa", Codec2.DecodeResult.NEED_MORE_INPUT); } @Test - public void testDecode_Person_ObjectOnly() throws IOException { + void testDecode_Person_ObjectOnly() throws IOException { testDecode_assertEquals(new Person(), Codec2.DecodeResult.NEED_MORE_INPUT); } @Test - public void testDecode_Person_WithEnter() throws IOException { + void testDecode_Person_WithEnter() throws IOException { testDecode_PersonWithEnterByte(new byte[]{'\r', '\n'}, false);//windows end testDecode_PersonWithEnterByte(new byte[]{'\n', '\r'}, true); testDecode_PersonWithEnterByte(new byte[]{'\n'}, false); //linux end @@ -228,7 +228,7 @@ public class TelnetCodecTest { } @Test - public void testDecode_WithExitByte() throws IOException { + void testDecode_WithExitByte() throws IOException { HashMap exitBytes = new HashMap(); exitBytes.put(new byte[]{3}, true); /* Windows Ctrl+C */ exitBytes.put(new byte[]{1, 3}, false); //must equal the bytes @@ -242,7 +242,7 @@ public class TelnetCodecTest { } @Test - public void testDecode_Backspace() throws IOException { + void testDecode_Backspace() throws IOException { //32 8 first add space and then add backspace. testDecode_assertEquals(new byte[]{'\b'}, Codec2.DecodeResult.NEED_MORE_INPUT, new String(new byte[]{32, 8})); @@ -255,7 +255,7 @@ public class TelnetCodecTest { } @Test - public void testDecode_Backspace_WithError() throws IOException { + void testDecode_Backspace_WithError() throws IOException { Assertions.assertThrows(IOException.class, () -> { url = url.addParameter(AbstractMockChannel.ERROR_WHEN_SEND, Boolean.TRUE.toString()); testDecode_Backspace(); @@ -264,7 +264,7 @@ public class TelnetCodecTest { } @Test - public void testDecode_History_UP() throws IOException { + void testDecode_History_UP() throws IOException { //init channel AbstractMockChannel channel = getServerSideChannel(url); @@ -279,7 +279,7 @@ public class TelnetCodecTest { } @Test - public void testDecode_UPorDOWN_WithError() throws IOException { + void testDecode_UPorDOWN_WithError() throws IOException { Assertions.assertThrows(IOException.class, () -> { url = url.addParameter(AbstractMockChannel.ERROR_WHEN_SEND, Boolean.TRUE.toString()); @@ -301,7 +301,7 @@ public class TelnetCodecTest { //============================================================================================================================= @Test - public void testEncode_String_ClientSide() throws IOException { + void testEncode_String_ClientSide() throws IOException { testEecode_assertEquals("aaa", "aaa\r\n".getBytes(), false); } diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/ExchangersTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/ExchangersTest.java index 0306d850e1..f6a991d164 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/ExchangersTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/ExchangersTest.java @@ -26,10 +26,10 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class ExchangersTest { +class ExchangersTest { @Test - public void testBind() throws RemotingException { + void testBind() throws RemotingException { String url = "dubbo://127.0.0.1:12345?exchanger=mockExchanger"; Exchangers.bind(url, Mockito.mock(Replier.class)); Exchangers.bind(url, new ChannelHandlerAdapter(), Mockito.mock(Replier.class)); @@ -42,7 +42,7 @@ public class ExchangersTest { } @Test - public void testConnect() throws RemotingException { + void testConnect() throws RemotingException { String url = "dubbo://127.0.0.1:12345?exchanger=mockExchanger"; Exchangers.connect(url); Exchangers.connect(url, Mockito.mock(Replier.class)); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/RequestTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/RequestTest.java index 9e7f14fbdb..f0a8988ee7 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/RequestTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/RequestTest.java @@ -19,10 +19,10 @@ package org.apache.dubbo.remoting.exchange; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class RequestTest { +class RequestTest { @Test - public void test() { + void test() { Request request = new Request(); request.setTwoWay(true); request.setBroken(true); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/ResponseTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/ResponseTest.java index e4e1a63ede..54d135bd9b 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/ResponseTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/ResponseTest.java @@ -21,9 +21,9 @@ import org.junit.jupiter.api.Test; import static org.apache.dubbo.common.constants.CommonConstants.HEARTBEAT_EVENT; -public class ResponseTest { +class ResponseTest { @Test - public void test() { + void test() { Response response = new Response(); response.setStatus(Response.OK); response.setId(1); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/DefaultFutureTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/DefaultFutureTest.java index 62f9b6d616..47a350ba12 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/DefaultFutureTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/DefaultFutureTest.java @@ -35,18 +35,18 @@ import java.time.format.DateTimeFormatter; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; -public class DefaultFutureTest { +class DefaultFutureTest { private static final AtomicInteger index = new AtomicInteger(); @Test - public void newFuture() { + void newFuture() { DefaultFuture future = defaultFuture(3000); Assertions.assertNotNull(future, "new future return null"); } @Test - public void isDone() { + void isDone() { DefaultFuture future = defaultFuture(3000); Assertions.assertTrue(!future.isDone(), "init future is finished!"); @@ -127,7 +127,7 @@ public class DefaultFutureTest { * after a future is timeout , time is : 2021-01-22 10:55:05 */ @Test - public void interruptSend() throws Exception { + void interruptSend() throws Exception { final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); System.out.println("before a future is create , time is : " + LocalDateTime.now().format(formatter)); // timeout after 1 seconds. @@ -159,7 +159,7 @@ public class DefaultFutureTest { } @Test - public void testClose() throws Exception { + void testClose() throws Exception { Channel channel = new MockedChannel(); Request request = new Request(123); ExecutorService executor = ExtensionLoader.getExtensionLoader(ExecutorRepository.class) diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/ExchangeHandlerDispatcherTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/ExchangeHandlerDispatcherTest.java index 1325d1b177..f06ae441e5 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/ExchangeHandlerDispatcherTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/ExchangeHandlerDispatcherTest.java @@ -26,10 +26,10 @@ import org.mockito.Mockito; import java.lang.reflect.Field; -public class ExchangeHandlerDispatcherTest { +class ExchangeHandlerDispatcherTest { @Test - public void test() throws Exception { + void test() throws Exception { ExchangeHandlerDispatcher exchangeHandlerDispatcher = new ExchangeHandlerDispatcher(); ChannelHandler channelHandler = Mockito.mock(ChannelHandler.class); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/MultiMessageTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/MultiMessageTest.java index 1aa57f3196..5cfb6fdacf 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/MultiMessageTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/MultiMessageTest.java @@ -26,10 +26,10 @@ import java.util.Iterator; /** * {@link MultiMessage} */ -public class MultiMessageTest { +class MultiMessageTest { @Test - public void test() { + void test() { MultiMessage multiMessage = MultiMessage.create(); Assertions.assertTrue(multiMessage instanceof Iterable); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/CloseTimerTaskTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/CloseTimerTaskTest.java index 979d9a6c84..f9d232575d 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/CloseTimerTaskTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/CloseTimerTaskTest.java @@ -33,7 +33,7 @@ import static org.apache.dubbo.remoting.Constants.HEARTBEAT_CHECK_TICK; /** * {@link CloseTimerTask} */ -public class CloseTimerTaskTest { +class CloseTimerTaskTest { private URL url = URL.valueOf("dubbo://localhost:20880"); @@ -58,7 +58,7 @@ public class CloseTimerTaskTest { } @Test - public void testClose() throws Exception { + void testClose() throws Exception { long now = System.currentTimeMillis(); url = url.addParameter(DUBBO_VERSION_KEY, "2.1.1"); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannelTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannelTest.java index 513408a042..150752639c 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannelTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannelTest.java @@ -34,7 +34,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class HeaderExchangeChannelTest { +class HeaderExchangeChannelTest { private HeaderExchangeChannel header; private MockChannel channel; @@ -54,14 +54,14 @@ public class HeaderExchangeChannelTest { } @Test - public void getOrAddChannelTest00() { + void getOrAddChannelTest00() { channel.setAttribute("CHANNEL_KEY", "attribute"); HeaderExchangeChannel ret = HeaderExchangeChannel.getOrAddChannel(channel); Assertions.assertNotNull(ret); } @Test - public void getOrAddChannelTest01() { + void getOrAddChannelTest01() { channel = new MockChannel() { @Override public URL getUrl() { @@ -82,7 +82,7 @@ public class HeaderExchangeChannelTest { } @Test - public void getOrAddChannelTest02() { + void getOrAddChannelTest02() { channel = null; HeaderExchangeChannel ret = HeaderExchangeChannel.getOrAddChannel(channel); Assertions.assertNull(ret); @@ -90,7 +90,7 @@ public class HeaderExchangeChannelTest { @Test - public void removeChannelIfDisconnectedTest() { + void removeChannelIfDisconnectedTest() { Assertions.assertNull(channel.getAttribute(CHANNEL_KEY)); channel.setAttribute(CHANNEL_KEY, header); channel.close(); @@ -99,7 +99,7 @@ public class HeaderExchangeChannelTest { } @Test - public void sendTest00() { + void sendTest00() { boolean sent = true; String message = "this is a test message"; try { @@ -111,7 +111,7 @@ public class HeaderExchangeChannelTest { } @Test - public void sendTest01() throws RemotingException { + void sendTest01() throws RemotingException { boolean sent = true; String message = "this is a test message"; header.send(message, sent); @@ -120,7 +120,7 @@ public class HeaderExchangeChannelTest { } @Test - public void sendTest02() throws RemotingException { + void sendTest02() throws RemotingException { boolean sent = true; int message = 1; header.send(message, sent); @@ -131,7 +131,7 @@ public class HeaderExchangeChannelTest { } @Test - public void sendTest04() throws RemotingException { + void sendTest04() throws RemotingException { String message = "this is a test message"; header.send(message); List objects = channel.getSentObjects(); @@ -139,7 +139,7 @@ public class HeaderExchangeChannelTest { } @Test - public void requestTest01() throws RemotingException { + void requestTest01() throws RemotingException { Assertions.assertThrows(RemotingException.class, () -> { header.close(1000); Object requestObject = new Object(); @@ -148,7 +148,7 @@ public class HeaderExchangeChannelTest { } @Test - public void requestTest02() throws RemotingException { + void requestTest02() throws RemotingException { Channel channel = Mockito.mock(MockChannel.class); header = new HeaderExchangeChannel(channel); when(channel.getUrl()).thenReturn(url); @@ -160,7 +160,7 @@ public class HeaderExchangeChannelTest { } @Test - public void requestTest03() throws RemotingException { + void requestTest03() throws RemotingException { Assertions.assertThrows(RemotingException.class, () -> { channel = new MockChannel() { @Override @@ -175,12 +175,12 @@ public class HeaderExchangeChannelTest { } @Test - public void isClosedTest() { + void isClosedTest() { Assertions.assertFalse(header.isClosed()); } @Test - public void closeTest() { + void closeTest() { Assertions.assertFalse(channel.isClosed()); header.close(); Assertions.assertTrue(channel.isClosed()); @@ -188,7 +188,7 @@ public class HeaderExchangeChannelTest { @Test - public void closeWithTimeoutTest02() { + void closeWithTimeoutTest02() { Assertions.assertFalse(channel.isClosed()); Request request = new Request(); DefaultFuture.newFuture(channel, request, 100, null); @@ -199,7 +199,7 @@ public class HeaderExchangeChannelTest { @Test - public void startCloseTest() { + void startCloseTest() { try { boolean isClosing = channel.isClosing(); Assertions.assertFalse(isClosing); @@ -212,46 +212,46 @@ public class HeaderExchangeChannelTest { } @Test - public void getLocalAddressTest() { + void getLocalAddressTest() { Assertions.assertNull(header.getLocalAddress()); } @Test - public void getRemoteAddressTest() { + void getRemoteAddressTest() { Assertions.assertNull(header.getRemoteAddress()); } @Test - public void getUrlTest() { + void getUrlTest() { Assertions.assertEquals(header.getUrl(), URL.valueOf("dubbo://localhost:20880")); } @Test - public void isConnectedTest() { + void isConnectedTest() { Assertions.assertFalse(header.isConnected()); } @Test - public void getChannelHandlerTest() { + void getChannelHandlerTest() { Assertions.assertNull(header.getChannelHandler()); } @Test - public void getExchangeHandlerTest() { + void getExchangeHandlerTest() { Assertions.assertNull(header.getExchangeHandler()); } @Test - public void getAttributeAndSetAttributeTest() { + void getAttributeAndSetAttributeTest() { header.setAttribute("test", "test"); Assertions.assertEquals(header.getAttribute("test"), "test"); Assertions.assertTrue(header.hasAttribute("test")); } @Test - public void removeAttributeTest() { + void removeAttributeTest() { header.setAttribute("test", "test"); Assertions.assertEquals(header.getAttribute("test"), "test"); header.removeAttribute("test"); @@ -260,14 +260,14 @@ public class HeaderExchangeChannelTest { @Test - public void hasAttributeTest() { + void hasAttributeTest() { Assertions.assertFalse(header.hasAttribute("test")); header.setAttribute("test", "test"); Assertions.assertTrue(header.hasAttribute("test")); } @Test - public void hashCodeTest() { + void hashCodeTest() { final int prime = 31; int result = 1; result = prime * result + ((channel == null) ? 0 : channel.hashCode()); @@ -276,7 +276,7 @@ public class HeaderExchangeChannelTest { } @Test - public void equalsTest() { + void equalsTest() { Assertions.assertThrows(IllegalArgumentException.class, () -> { Assertions.assertEquals(header, new HeaderExchangeChannel(channel)); header = new HeaderExchangeChannel(null); @@ -286,7 +286,7 @@ public class HeaderExchangeChannelTest { @Test - public void toStringTest() { + void toStringTest() { Assertions.assertEquals(header.toString(), channel.toString()); } } diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServerTest.java index 0c9a7f2791..5fedc828df 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServerTest.java @@ -34,10 +34,10 @@ import java.util.Collection; /** * {@link HeaderExchangeServer} */ -public class HeaderExchangeServerTest { +class HeaderExchangeServerTest { @Test - public void test() throws InterruptedException, RemotingException { + void test() throws InterruptedException, RemotingException { RemotingServer server = Mockito.mock(RemotingServer.class); URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 20881); Mockito.when(server.getUrl()).thenReturn(url); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartBeatTaskTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartBeatTaskTest.java index eea1b2386f..cb07c11df7 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartBeatTaskTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartBeatTaskTest.java @@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit; import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_VERSION_KEY; import static org.apache.dubbo.remoting.Constants.HEARTBEAT_CHECK_TICK; -public class HeartBeatTaskTest { +class HeartBeatTaskTest { private URL url = URL.valueOf("dubbo://localhost:20880"); @@ -60,7 +60,7 @@ public class HeartBeatTaskTest { } @Test - public void testHeartBeat() throws Exception { + void testHeartBeat() throws Exception { long now = System.currentTimeMillis(); url = url.addParameter(DUBBO_VERSION_KEY, "2.1.1"); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/ReconnectTimerTaskTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/ReconnectTimerTaskTest.java index 40ad03fe75..5b8f30006d 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/ReconnectTimerTaskTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/support/header/ReconnectTimerTaskTest.java @@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit; import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_VERSION_KEY; import static org.apache.dubbo.remoting.Constants.HEARTBEAT_CHECK_TICK; -public class ReconnectTimerTaskTest { +class ReconnectTimerTaskTest { private URL url = URL.valueOf("dubbo://localhost:20880"); @@ -61,7 +61,7 @@ public class ReconnectTimerTaskTest { } @Test - public void testReconnect() throws Exception { + void testReconnect() throws Exception { long now = System.currentTimeMillis(); url = url.addParameter(DUBBO_VERSION_KEY, "2.1.1"); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/ConnectChannelHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/ConnectChannelHandlerTest.java index a6532bd5c0..c131b8bbe7 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/ConnectChannelHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/ConnectChannelHandlerTest.java @@ -32,7 +32,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.atomic.AtomicInteger; -public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest { +class ConnectChannelHandlerTest extends WrappedChannelHandlerTest { @BeforeEach public void setUp() throws Exception { @@ -41,7 +41,7 @@ public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest { } @Test - public void testConnectBlocked() throws RemotingException { + void testConnectBlocked() throws RemotingException { handler = new ConnectionOrderedChannelHandler(new BizChannelHandler(false), url); ThreadPoolExecutor executor = (ThreadPoolExecutor) getField(handler, "connectionExecutor", 1); Assertions.assertEquals(1, executor.getMaximumPoolSize()); @@ -77,7 +77,7 @@ public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest { } @Test - public void testConnectExecuteError() throws RemotingException { + void testConnectExecuteError() throws RemotingException { Assertions.assertThrows(ExecutionException.class, () -> { handler = new ConnectionOrderedChannelHandler(new BizChannelHandler(false), url); ThreadPoolExecutor executor = (ThreadPoolExecutor) getField(handler, "connectionExecutor", 1); @@ -87,7 +87,7 @@ public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest { } @Test - public void testDisconnectExecuteError() throws RemotingException { + void testDisconnectExecuteError() throws RemotingException { Assertions.assertThrows(ExecutionException.class, () -> { handler = new ConnectionOrderedChannelHandler(new BizChannelHandler(false), url); ThreadPoolExecutor executor = (ThreadPoolExecutor) getField(handler, "connectionExecutor", 1); @@ -104,7 +104,7 @@ public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest { //throw ChannelEventRunnable.runtimeExeception(int logger) not in execute exception @Test - public void testCaughtBizError() throws RemotingException { + void testCaughtBizError() throws RemotingException { handler.caught(new MockedChannel(), new BizException()); } @@ -127,7 +127,7 @@ public class ConnectChannelHandlerTest extends WrappedChannelHandlerTest { @SuppressWarnings("deprecation") @Disabled("Heartbeat is processed in HeartbeatHandler not WrappedChannelHandler.") @Test - public void testReceivedEventInvokeDirect() throws RemotingException { + void testReceivedEventInvokeDirect() throws RemotingException { handler = new ConnectionOrderedChannelHandler(new BizChannelHandler(false), url); ThreadPoolExecutor executor = (ThreadPoolExecutor) getField(handler, "SHARED_EXECUTOR", 1); executor.shutdown(); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/HeaderExchangeHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/HeaderExchangeHandlerTest.java index 721ac56f9f..7cd1437d59 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/HeaderExchangeHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/HeaderExchangeHandlerTest.java @@ -37,10 +37,10 @@ import static org.apache.dubbo.common.constants.CommonConstants.HEARTBEAT_EVENT; import static org.apache.dubbo.common.constants.CommonConstants.READONLY_EVENT; //TODO response test -public class HeaderExchangeHandlerTest { +class HeaderExchangeHandlerTest { @Test - public void testReceivedRequestOneway() throws RemotingException { + void testReceivedRequestOneway() throws RemotingException { final Channel mockChannel = new MockedChannel(); final Person requestData = new Person("charles"); @@ -59,7 +59,7 @@ public class HeaderExchangeHandlerTest { } @Test - public void testReceivedRequestTwoway() throws RemotingException { + void testReceivedRequestTwoway() throws RemotingException { final Person requestData = new Person("charles"); final Request request = new Request(); request.setTwoWay(true); @@ -95,12 +95,12 @@ public class HeaderExchangeHandlerTest { } @Test - public void testReceivedRequestTwowayErrorWithNullHandler() throws RemotingException { + void testReceivedRequestTwowayErrorWithNullHandler() throws RemotingException { Assertions.assertThrows(IllegalArgumentException.class, () -> new HeaderExchangeHandler(null)); } @Test - public void testReceivedRequestTwowayErrorReply() throws RemotingException { + void testReceivedRequestTwowayErrorReply() throws RemotingException { final Person requestData = new Person("charles"); final Request request = new Request(); request.setTwoWay(true); @@ -131,7 +131,7 @@ public class HeaderExchangeHandlerTest { } @Test - public void testReceivedRequestTwowayErrorRequestBroken() throws RemotingException { + void testReceivedRequestTwowayErrorRequestBroken() throws RemotingException { final Request request = new Request(); request.setTwoWay(true); request.setData(new BizException()); @@ -156,7 +156,7 @@ public class HeaderExchangeHandlerTest { } @Test - public void testReceivedRequestEventReadonly() throws RemotingException { + void testReceivedRequestEventReadonly() throws RemotingException { final Request request = new Request(); request.setTwoWay(true); request.setEvent(READONLY_EVENT); @@ -168,7 +168,7 @@ public class HeaderExchangeHandlerTest { } @Test - public void testReceivedRequestEventOtherDiscard() throws RemotingException { + void testReceivedRequestEventOtherDiscard() throws RemotingException { final Request request = new Request(); request.setTwoWay(true); request.setEvent("my event"); @@ -197,7 +197,7 @@ public class HeaderExchangeHandlerTest { } @Test - public void testReceivedResponseHeartbeatEvent() throws Exception { + void testReceivedResponseHeartbeatEvent() throws Exception { Channel mockChannel = new MockedChannel(); HeaderExchangeHandler headerExchangeHandler = new HeaderExchangeHandler(new MockedExchangeHandler()); Response response = new Response(1); @@ -208,7 +208,7 @@ public class HeaderExchangeHandlerTest { } @Test - public void testReceivedResponse() throws Exception { + void testReceivedResponse() throws Exception { Request request = new Request(1); request.setTwoWay(true); Channel mockChannel = new MockedChannel(); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/WrappedChannelHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/WrappedChannelHandlerTest.java index e3b36bf8ab..4ef2f5203a 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/WrappedChannelHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/WrappedChannelHandlerTest.java @@ -38,7 +38,7 @@ import java.util.concurrent.ExecutorService; import static org.junit.jupiter.api.Assertions.fail; -public class WrappedChannelHandlerTest { +class WrappedChannelHandlerTest { WrappedChannelHandler handler; URL url = URL.valueOf("test://10.20.30.40:1234"); @@ -49,7 +49,7 @@ public class WrappedChannelHandlerTest { } @Test - public void test_Execute_Error() throws RemotingException { + void test_Execute_Error() throws RemotingException { } @@ -88,22 +88,22 @@ public class WrappedChannelHandlerTest { } @Test - public void testConnectBizError() throws RemotingException { + void testConnectBizError() throws RemotingException { Assertions.assertThrows(RemotingException.class, () -> handler.connected(new MockedChannel())); } @Test - public void testDisconnectBizError() throws RemotingException { + void testDisconnectBizError() throws RemotingException { Assertions.assertThrows(RemotingException.class, () -> handler.disconnected(new MockedChannel())); } @Test - public void testMessageReceivedBizError() throws RemotingException { + void testMessageReceivedBizError() throws RemotingException { Assertions.assertThrows(RemotingException.class, () -> handler.received(new MockedChannel(), "")); } @Test - public void testCaughtBizError() throws RemotingException { + void testCaughtBizError() throws RemotingException { try { handler.caught(new MockedChannel(), new BizException()); fail(); @@ -113,7 +113,7 @@ public class WrappedChannelHandlerTest { } @Test - public void testGetExecutor() { + void testGetExecutor() { ExecutorService sharedExecutorService = handler.getSharedExecutorService(); Assertions.assertNotNull(sharedExecutorService); ExecutorService preferredExecutorService = handler.getPreferredExecutorService(new Object()); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/TelnetUtilsTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/TelnetUtilsTest.java index 1822837f34..452a3df5c0 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/TelnetUtilsTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/TelnetUtilsTest.java @@ -25,7 +25,7 @@ import java.util.Arrays; import java.util.LinkedList; import java.util.List; -public class TelnetUtilsTest { +class TelnetUtilsTest { /** * abc - abc - abc @@ -33,7 +33,7 @@ public class TelnetUtilsTest { * x - y - z */ @Test - public void testToList() { + void testToList() { List> table = new LinkedList<>(); table.add(Arrays.asList("abc","abc","abc")); table.add(Arrays.asList("1","2","3")); @@ -56,7 +56,7 @@ public class TelnetUtilsTest { * +-----+-----+-----+ */ @Test - public void testToTable() { + void testToTable() { List> table = new LinkedList<>(); table.add(Arrays.asList("abc","abc","abc")); table.add(Arrays.asList("1","2","3")); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/ClearTelnetHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/ClearTelnetHandlerTest.java index 7671ab594b..c9163fb98e 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/ClearTelnetHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/ClearTelnetHandlerTest.java @@ -23,10 +23,10 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class ClearTelnetHandlerTest { +class ClearTelnetHandlerTest { @Test - public void test() { + void test() { StringBuilder buf = new StringBuilder(); for (int i = 0; i < 50; i++) { buf.append("\r\n"); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/ExitTelnetHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/ExitTelnetHandlerTest.java index 470f3106cf..e42df43d75 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/ExitTelnetHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/ExitTelnetHandlerTest.java @@ -25,9 +25,9 @@ import org.mockito.Mockito; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -public class ExitTelnetHandlerTest { +class ExitTelnetHandlerTest { @Test - public void test() { + void test() { Channel channel = Mockito.mock(Channel.class); ExitTelnetHandler exitTelnetHandler = new ExitTelnetHandler(); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/HelpTelnetHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/HelpTelnetHandlerTest.java index 2f2a10e3e5..45193504eb 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/HelpTelnetHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/HelpTelnetHandlerTest.java @@ -24,9 +24,9 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class HelpTelnetHandlerTest { +class HelpTelnetHandlerTest { @Test - public void test() { + void test() { Channel channel = Mockito.mock(Channel.class); Mockito.when(channel.getUrl()).thenReturn(URL.valueOf("dubbo://127.0.0.1:12345")); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/StatusTelnetHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/StatusTelnetHandlerTest.java index 56e884dca1..9fc9da5824 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/StatusTelnetHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/StatusTelnetHandlerTest.java @@ -24,9 +24,9 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class StatusTelnetHandlerTest { +class StatusTelnetHandlerTest { @Test - public void test() { + void test() { Channel channel = Mockito.mock(Channel.class); Mockito.when(channel.getUrl()).thenReturn(URL.valueOf("dubbo://127.0.0.1:12345")); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/TelnetHandlerAdapterTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/TelnetHandlerAdapterTest.java index 17b120522e..b530827980 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/TelnetHandlerAdapterTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/telnet/support/TelnetHandlerAdapterTest.java @@ -31,7 +31,7 @@ import java.util.Map; class TelnetHandlerAdapterTest { @Test - public void testTelnet() throws RemotingException { + void testTelnet() throws RemotingException { Channel channel = Mockito.mock(Channel.class); Map param = new HashMap<>(); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/AbstractCodecTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/AbstractCodecTest.java index 020ad79760..59236928a3 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/AbstractCodecTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/AbstractCodecTest.java @@ -34,10 +34,10 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -public class AbstractCodecTest { +class AbstractCodecTest { @Test - public void testCheckPayloadDefault8M() throws Exception { + void testCheckPayloadDefault8M() throws Exception { Channel channel = mock(Channel.class); given(channel.getUrl()).willReturn(URL.valueOf("dubbo://1.1.1.1")); @@ -56,7 +56,7 @@ public class AbstractCodecTest { } @Test - public void tesCheckPayloadMinusPayloadNoLimit() throws Exception { + void tesCheckPayloadMinusPayloadNoLimit() throws Exception { Channel channel = mock(Channel.class); given(channel.getUrl()).willReturn(URL.valueOf("dubbo://1.1.1.1?payload=-1")); @@ -66,7 +66,7 @@ public class AbstractCodecTest { } @Test - public void testIsClientSide() { + void testIsClientSide() { AbstractCodec codec = getAbstractCodec(); Channel channel = mock(Channel.class); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/ChannelHandlerDispatcherTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/ChannelHandlerDispatcherTest.java index 1abca7cc3d..72056cf991 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/ChannelHandlerDispatcherTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/ChannelHandlerDispatcherTest.java @@ -26,10 +26,10 @@ import org.mockito.Mockito; import java.util.Collection; -public class ChannelHandlerDispatcherTest { +class ChannelHandlerDispatcherTest { @Test - public void test() { + void test() { ChannelHandlerDispatcher channelHandlerDispatcher = new ChannelHandlerDispatcher(); MockChannelHandler channelHandler1 = new MockChannelHandler(); MockChannelHandler channelHandler2 = new MockChannelHandler(); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/CodecSupportTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/CodecSupportTest.java index b8ab5e4528..5411a608a6 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/CodecSupportTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/CodecSupportTest.java @@ -19,7 +19,6 @@ package org.apache.dubbo.remoting.transport; import org.apache.dubbo.common.serialize.ObjectOutput; import org.apache.dubbo.common.serialize.Serialization; import org.apache.dubbo.common.serialize.support.DefaultSerializationSelector; -import org.apache.dubbo.remoting.Constants; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -29,10 +28,10 @@ import java.io.ByteArrayOutputStream; import java.io.InputStream; -public class CodecSupportTest { +class CodecSupportTest { @Test - public void testHeartbeat() throws Exception { + void testHeartbeat() throws Exception { Byte proto = CodecSupport.getIDByName(DefaultSerializationSelector.getDefaultRemotingSerialization()); Serialization serialization = CodecSupport.getSerializationById(proto); byte[] nullBytes = CodecSupport.getNullBytesOf(serialization); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/DecodeHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/DecodeHandlerTest.java index adb2fae625..ae43475e3b 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/DecodeHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/DecodeHandlerTest.java @@ -29,10 +29,10 @@ import org.mockito.Mockito; /** * {@link DecodeHandler} */ -public class DecodeHandlerTest { +class DecodeHandlerTest { @Test - public void test() throws Exception { + void test() throws Exception { ChannelHandler handler = Mockito.mock(ChannelHandler.class); Channel channel = Mockito.mock(Channel.class); DecodeHandler decodeHandler = new DecodeHandler(handler); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/MultiMessageHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/MultiMessageHandlerTest.java index 2c20351cdd..5c0e3849f6 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/MultiMessageHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/MultiMessageHandlerTest.java @@ -28,10 +28,10 @@ import org.mockito.Mockito; /** * {@link MultiMessageHandler} */ -public class MultiMessageHandlerTest { +class MultiMessageHandlerTest { @Test - public void test() throws Exception { + void test() throws Exception { ChannelHandler handler = Mockito.mock(ChannelHandler.class); Channel channel = Mockito.mock(Channel.class); MultiMessageHandler multiMessageHandler = new MultiMessageHandler(handler); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/CodecAdapterTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/CodecAdapterTest.java index 3a157b32ca..928e95e147 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/CodecAdapterTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/CodecAdapterTest.java @@ -20,7 +20,7 @@ import org.apache.dubbo.remoting.codec.ExchangeCodecTest; import org.junit.jupiter.api.BeforeEach; -public class CodecAdapterTest extends ExchangeCodecTest { +class CodecAdapterTest extends ExchangeCodecTest { @BeforeEach public void setUp() throws Exception { diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelEventRunnableTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelEventRunnableTest.java index 18610b1a34..59641bf20e 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelEventRunnableTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelEventRunnableTest.java @@ -29,10 +29,10 @@ import java.util.Arrays; /** * {@link ChannelEventRunnable} */ -public class ChannelEventRunnableTest { +class ChannelEventRunnableTest { @Test - public void test() throws Exception { + void test() throws Exception { ChannelEventRunnable.ChannelState[] values = ChannelEventRunnable.ChannelState.values(); Assertions.assertEquals(Arrays.toString(values), "[CONNECTED, DISCONNECTED, SENT, RECEIVED, CAUGHT]"); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelHandlersTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelHandlersTest.java index 7a173b8ae5..8c7ccbf724 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelHandlersTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelHandlersTest.java @@ -25,9 +25,9 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class ChannelHandlersTest { +class ChannelHandlersTest { @Test - public void test() { + void test() { ChannelHandlers instance1 = ChannelHandlers.getInstance(); ChannelHandlers instance2 = ChannelHandlers.getInstance(); Assertions.assertEquals(instance1, instance2); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/utils/PayloadDropperTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/utils/PayloadDropperTest.java index 0e55032006..d8317e397a 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/utils/PayloadDropperTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/utils/PayloadDropperTest.java @@ -22,9 +22,9 @@ import org.apache.dubbo.remoting.exchange.Response; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class PayloadDropperTest { +class PayloadDropperTest { @Test - public void test() { + void test() { Request request = new Request(1); request.setData(new Object()); Request requestWithoutData = (Request) PayloadDropper.getRequestWithoutData(request); diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/utils/UrlUtilsTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/utils/UrlUtilsTest.java index 7b475aecc8..40460c470e 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/utils/UrlUtilsTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/utils/UrlUtilsTest.java @@ -21,9 +21,9 @@ import org.apache.dubbo.common.URL; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class UrlUtilsTest { +class UrlUtilsTest { @Test - public void testGetIdleTimeout() { + void testGetIdleTimeout() { URL url1 = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000"); URL url2 = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000&heartbeat.timeout=50000"); URL url3 = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000&heartbeat.timeout=10000"); @@ -33,7 +33,7 @@ public class UrlUtilsTest { } @Test - public void testGetHeartbeat() { + void testGetHeartbeat() { URL url = URL.valueOf("dubbo://127.0.0.1:12345?heartbeat=10000"); Assertions.assertEquals(UrlUtils.getHeartbeat(url), 10000); } diff --git a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyHttpBinderTest.java b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyHttpBinderTest.java index c8499508f8..16f7bfd799 100644 --- a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyHttpBinderTest.java +++ b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyHttpBinderTest.java @@ -33,9 +33,9 @@ import java.io.IOException; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -public class JettyHttpBinderTest { +class JettyHttpBinderTest { @Test - public void shouldAbleHandleRequestForJettyBinder() throws Exception { + void shouldAbleHandleRequestForJettyBinder() throws Exception { int port = NetUtils.getAvailablePort(); URL url = new ServiceConfigURL("http", "localhost", port, new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)}); diff --git a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyLoggerAdapterTest.java b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyLoggerAdapterTest.java index 948bea258a..b300b27279 100644 --- a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyLoggerAdapterTest.java +++ b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/jetty/JettyLoggerAdapterTest.java @@ -42,10 +42,10 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class JettyLoggerAdapterTest { +class JettyLoggerAdapterTest { @Test - public void testJettyUseDubboLogger() throws Exception{ + void testJettyUseDubboLogger() throws Exception{ int port = NetUtils.getAvailablePort(); URL url = new ServiceConfigURL("http", "localhost", port, new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)}); @@ -64,7 +64,7 @@ public class JettyLoggerAdapterTest { @Test - public void testSuccessLogger() throws Exception{ + void testSuccessLogger() throws Exception{ Logger successLogger = mock(Logger.class); Class clazz = Class.forName("org.apache.dubbo.remoting.http.jetty.JettyLoggerAdapter"); JettyLoggerAdapter jettyLoggerAdapter = (JettyLoggerAdapter) clazz.newInstance(); @@ -98,7 +98,7 @@ public class JettyLoggerAdapterTest { @Test - public void testNewLogger(){ + void testNewLogger(){ JettyLoggerAdapter loggerAdapter = new JettyLoggerAdapter(); org.eclipse.jetty.util.log.Logger logger = loggerAdapter.newLogger(this.getClass().getName()); assertThat(logger.getClass().isAssignableFrom(JettyLoggerAdapter.class), is(true)); @@ -106,7 +106,7 @@ public class JettyLoggerAdapterTest { @Test - public void testDebugEnabled(){ + void testDebugEnabled(){ JettyLoggerAdapter loggerAdapter = new JettyLoggerAdapter(); loggerAdapter.setDebugEnabled(true); assertThat(loggerAdapter.isDebugEnabled(), is(true)); @@ -114,7 +114,7 @@ public class JettyLoggerAdapterTest { @Test - public void testLoggerFormat() throws Exception{ + void testLoggerFormat() throws Exception{ Class clazz = Class.forName("org.apache.dubbo.remoting.http.jetty.JettyLoggerAdapter"); Object newInstance = clazz.newInstance(); diff --git a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java index 25058b117b..10d6423963 100644 --- a/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java +++ b/dubbo-remoting/dubbo-remoting-http/src/test/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpBinderTest.java @@ -33,9 +33,9 @@ import java.io.IOException; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -public class TomcatHttpBinderTest { +class TomcatHttpBinderTest { @Test - public void shouldAbleHandleRequestForTomcatBinder() throws Exception { + void shouldAbleHandleRequestForTomcatBinder() throws Exception { int port = NetUtils.getAvailablePort(); URL url = new ServiceConfigURL("http", "localhost", port, new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)}); diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java index 3fbac2286a..d457f5e33a 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/exchange/support/header/HeartbeatHandlerTest.java @@ -38,7 +38,7 @@ import org.junit.jupiter.api.Test; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; -public class HeartbeatHandlerTest { +class HeartbeatHandlerTest { private static final Logger logger = LoggerFactory.getLogger(HeartbeatHandlerTest.class); @@ -64,7 +64,7 @@ public class HeartbeatHandlerTest { } @Test - public void testServerHeartbeat() throws Exception { + void testServerHeartbeat() throws Exception { FakeChannelHandlers.resetChannelHandlers(); URL serverURL = URL.valueOf("telnet://localhost:" + NetUtils.getAvailablePort(56780)) .addParameter(Constants.EXCHANGER_KEY, HeaderExchanger.NAME) @@ -91,7 +91,7 @@ public class HeartbeatHandlerTest { } @Test - public void testHeartbeat() throws Exception { + void testHeartbeat() throws Exception { URL serverURL = URL.valueOf("telnet://localhost:" + NetUtils.getAvailablePort(56785)) .addParameter(Constants.EXCHANGER_KEY, HeaderExchanger.NAME) .addParameter(Constants.TRANSPORTER_KEY, "netty3") @@ -112,7 +112,7 @@ public class HeartbeatHandlerTest { } @Test - public void testClientHeartbeat() throws Exception { + void testClientHeartbeat() throws Exception { FakeChannelHandlers.setTestingChannelHandlers(); URL serverURL = URL.valueOf("telnet://localhost:" + NetUtils.getAvailablePort(56790)) .addParameter(Constants.EXCHANGER_KEY, HeaderExchanger.NAME) diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java index edc65c901c..81717a0e1e 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java @@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test; /** * Client reconnect test */ -public class ClientReconnectTest { +class ClientReconnectTest { @BeforeEach public void clear() { @@ -41,7 +41,7 @@ public class ClientReconnectTest { } @Test - public void testReconnect() throws RemotingException, InterruptedException { + void testReconnect() throws RemotingException, InterruptedException { { int port = NetUtils.getAvailablePort(); Client client = startClient(port, 200); diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientToServerTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientToServerTest.java index f7a90bcdf6..243935500d 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientToServerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientToServerTest.java @@ -64,7 +64,7 @@ public abstract class ClientToServerTest { } @Test - public void testFuture() throws Exception { + void testFuture() throws Exception { CompletableFuture future = client.request(new World("world")); Hello result = (Hello) future.get(); Assertions.assertEquals("hello,world", result.getName()); diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientsTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientsTest.java index 1be36d333e..dfcd94a447 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientsTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientsTest.java @@ -28,10 +28,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.fail; -public class ClientsTest { +class ClientsTest { @Test - public void testGetTransportEmpty() { + void testGetTransportEmpty() { try { ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(""); fail(); @@ -41,7 +41,7 @@ public class ClientsTest { } @Test - public void testGetTransportNull() { + void testGetTransportNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { String name = null; ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name); @@ -49,13 +49,13 @@ public class ClientsTest { } @Test - public void testGetTransport3() { + void testGetTransport3() { String name = "netty3"; assertEquals(NettyTransporter.class, ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name).getClass()); } @Test - public void testGetTransportWrong() { + void testGetTransportWrong() { Assertions.assertThrows(IllegalStateException.class, () -> { String name = "nety"; assertNull(ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name).getClass()); diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyBackedChannelBufferTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyBackedChannelBufferTest.java index 046774c3a7..99005d9140 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyBackedChannelBufferTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyBackedChannelBufferTest.java @@ -18,6 +18,7 @@ package org.apache.dubbo.remoting.transport.netty; import org.apache.dubbo.remoting.buffer.ChannelBuffer; + import org.jboss.netty.buffer.ChannelBuffers; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -25,7 +26,7 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -public class NettyBackedChannelBufferTest { +class NettyBackedChannelBufferTest { private static final int CAPACITY = 4096; @@ -42,7 +43,7 @@ public class NettyBackedChannelBufferTest { } @Test - public void testBufferTransfer() { + void testBufferTransfer() { byte[] tmp1 = {1, 2}; byte[] tmp2 = {3, 4}; ChannelBuffer source = new NettyBackedChannelBuffer(ChannelBuffers.dynamicBuffer(2)); diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientTest.java index 076ad34ece..675a1474a0 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientTest.java @@ -34,7 +34,7 @@ import java.util.List; * Date: 5/3/11 * Time: 5:47 PM */ -public class NettyClientTest { +class NettyClientTest { static RemotingServer server; static int port = NetUtils.getAvailablePort(); @@ -58,7 +58,7 @@ public class NettyClientTest { } @Test - public void testClientClose() throws Exception { + void testClientClose() throws Exception { List clients = new ArrayList(100); for (int i = 0; i < 100; i++) { ExchangeChannel client = Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?client=netty3&codec=exchange")); @@ -72,7 +72,7 @@ public class NettyClientTest { } @Test - public void testServerClose() throws Exception { + void testServerClose() throws Exception { for (int i = 0; i < 100; i++) { RemotingServer aServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + NetUtils.getAvailablePort(6000) + "?server=netty3&codec=exchange"), new TelnetServerHandler()); aServer.close(); diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientToServerTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientToServerTest.java index 51d8bd4df7..4a871e0fb7 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientToServerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientToServerTest.java @@ -27,7 +27,7 @@ import org.apache.dubbo.remoting.exchange.support.Replier; /** * NettyClientToServerTest */ -public class NettyClientToServerTest extends ClientToServerTest { +class NettyClientToServerTest extends ClientToServerTest { protected ExchangeServer newServer(int port, Replier receiver) throws RemotingException { // add heartbeat cycle to avoid unstable ut. diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyStringTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyStringTest.java index 6781897472..271e791173 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyStringTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyStringTest.java @@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test; * Date: 4/26/11 * Time: 4:13 PM */ -public class NettyStringTest { +class NettyStringTest { static ExchangeServer server; static ExchangeChannel client; @@ -56,7 +56,7 @@ public class NettyStringTest { } @Test - public void testHandler() throws Exception { + void testHandler() throws Exception { //Thread.sleep(20000); /*client.request("world\r\n"); Future future = client.request("world", 10000); diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ThreadNameTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ThreadNameTest.java index 998cb12260..d990649654 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ThreadNameTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ThreadNameTest.java @@ -32,7 +32,7 @@ import java.util.Random; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -public class ThreadNameTest { +class ThreadNameTest { private NettyServer server; private NettyClient client; @@ -79,7 +79,7 @@ public class ThreadNameTest { } @Test - public void testThreadName() throws Exception { + void testThreadName() throws Exception { client.send("hello"); serverLatch.await(30, TimeUnit.SECONDS); clientLatch.await(30, TimeUnit.SECONDS); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientReconnectTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientReconnectTest.java index 0a7dc8d439..6bccd39fb1 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientReconnectTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientReconnectTest.java @@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test; /** * Client reconnect test */ -public class ClientReconnectTest { +class ClientReconnectTest { public static void main(String[] args) { System.out.println(3 % 1); } @@ -44,7 +44,7 @@ public class ClientReconnectTest { } @Test - public void testReconnect() throws RemotingException, InterruptedException { + void testReconnect() throws RemotingException, InterruptedException { { int port = NetUtils.getAvailablePort(); Client client = startClient(port, 200); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientToServerTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientToServerTest.java index 2be1c03277..f97f31f1aa 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientToServerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientToServerTest.java @@ -63,7 +63,7 @@ public abstract class ClientToServerTest { } @Test - public void testFuture() throws Exception { + void testFuture() throws Exception { CompletableFuture future = client.request(new World("world")); Hello result = (Hello) future.get(); Assertions.assertEquals("hello,world", result.getName()); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientsTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientsTest.java index 24b755323f..4eb68351b7 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientsTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ClientsTest.java @@ -28,9 +28,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.fail; -public class ClientsTest { +class ClientsTest { @Test - public void testGetTransportEmpty() { + void testGetTransportEmpty() { try { ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(""); @@ -41,7 +41,7 @@ public class ClientsTest { } @Test - public void testGetTransportNull() { + void testGetTransportNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { String name = null; ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name); @@ -49,13 +49,13 @@ public class ClientsTest { } @Test - public void testGetTransport3() { + void testGetTransport3() { String name = "netty4"; assertEquals(NettyTransporter.class, ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name).getClass()); } @Test - public void testGetTransportWrong() { + void testGetTransportWrong() { Assertions.assertThrows(IllegalStateException.class, () -> { String name = "nety"; assertNull(ExtensionLoader.getExtensionLoader(Transporter.class).getExtension(name).getClass()); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyBackedChannelBufferTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyBackedChannelBufferTest.java index 5b2309efe3..f50bf21460 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyBackedChannelBufferTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyBackedChannelBufferTest.java @@ -17,16 +17,16 @@ package org.apache.dubbo.remoting.transport.netty4; -import io.netty.buffer.Unpooled; import org.apache.dubbo.remoting.buffer.ChannelBuffer; + +import io.netty.buffer.Unpooled; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; - import static org.junit.jupiter.api.Assertions.assertEquals; -public class NettyBackedChannelBufferTest { +class NettyBackedChannelBufferTest { private static final int CAPACITY = 4096; @@ -43,7 +43,7 @@ public class NettyBackedChannelBufferTest { } @Test - public void testBufferTransfer() { + void testBufferTransfer() { byte[] tmp1 = {1, 2}; byte[] tmp2 = {3, 4}; ChannelBuffer source = new NettyBackedChannelBuffer(Unpooled.buffer(2, 4)); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyChannelTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyChannelTest.java index 9a79ee2f2f..2d6c99deb7 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyChannelTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyChannelTest.java @@ -33,13 +33,13 @@ import org.mockito.Mockito; import java.net.InetSocketAddress; -public class NettyChannelTest { +class NettyChannelTest { private Channel channel = Mockito.mock(Channel.class); private URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 8080); private ChannelHandler channelHandler = Mockito.mock(ChannelHandler.class); @Test - public void test() throws Exception { + void test() throws Exception { Channel channel = Mockito.mock(Channel.class); Mockito.when(channel.isActive()).thenReturn(true); URL url = URL.valueOf("test://127.0.0.1/test"); @@ -67,7 +67,7 @@ public class NettyChannelTest { } @Test - public void testAddress() { + void testAddress() { NettyChannel nettyChannel = NettyChannel.getOrAddChannel(channel, url, channelHandler); InetSocketAddress localAddress = InetSocketAddress.createUnresolved("127.0.0.1", 8888); InetSocketAddress remoteAddress = InetSocketAddress.createUnresolved("127.0.0.1", 9999); @@ -78,7 +78,7 @@ public class NettyChannelTest { } @Test - public void testSend() throws Exception { + void testSend() throws Exception { Mockito.when(channel.eventLoop()).thenReturn(Mockito.mock(EventLoop.class)); Mockito.when(channel.alloc()).thenReturn(PooledByteBufAllocator.DEFAULT); NettyChannel nettyChannel = NettyChannel.getOrAddChannel(channel, url, channelHandler); @@ -115,7 +115,7 @@ public class NettyChannelTest { } @Test - public void testAttribute() { + void testAttribute() { NettyChannel nettyChannel = NettyChannel.getOrAddChannel(channel, url, channelHandler); nettyChannel.setAttribute("k1", "v1"); Assertions.assertTrue(nettyChannel.hasAttribute("k1")); @@ -125,7 +125,7 @@ public class NettyChannelTest { } @Test - public void testEquals() { + void testEquals() { Channel channel2 = Mockito.mock(Channel.class); NettyChannel nettyChannel = NettyChannel.getOrAddChannel(channel, url, channelHandler); NettyChannel nettyChannel2 = NettyChannel.getOrAddChannel(channel2, url, channelHandler); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandlerTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandlerTest.java index 7d5690c8a6..508153fd83 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyClientHandlerTest.java @@ -34,10 +34,10 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class NettyClientHandlerTest { +class NettyClientHandlerTest { @Test - public void test() throws Exception { + void test() throws Exception { URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 20901); ChannelHandler handler = Mockito.mock(ChannelHandler.class); ChannelHandlerContext ctx = Mockito.mock(ChannelHandlerContext.class); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyClientToServerTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyClientToServerTest.java index 3147ae89d0..79fe9b2571 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyClientToServerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyClientToServerTest.java @@ -27,7 +27,7 @@ import org.apache.dubbo.remoting.exchange.support.Replier; /** * Netty4ClientToServerTest */ -public class NettyClientToServerTest extends ClientToServerTest { +class NettyClientToServerTest extends ClientToServerTest { protected ExchangeServer newServer(int port, Replier receiver) throws RemotingException { // add heartbeat cycle to avoid unstable ut. diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyCodecAdapterTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyCodecAdapterTest.java index 9cb3e6597b..0a28ed3b13 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyCodecAdapterTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyCodecAdapterTest.java @@ -29,10 +29,10 @@ import org.mockito.Mockito; /** * {@link NettyCodecAdapter} */ -public class NettyCodecAdapterTest { +class NettyCodecAdapterTest { @Test - public void test() { + void test() { Codec2 codec2 = Mockito.mock(Codec2.class); URL url = Mockito.mock(URL.class); ChannelHandler handler = Mockito.mock(ChannelHandler.class); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyEventLoopFactoryTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyEventLoopFactoryTest.java index 342e47d161..98f647a846 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyEventLoopFactoryTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyEventLoopFactoryTest.java @@ -38,7 +38,7 @@ import static org.apache.dubbo.remoting.Constants.NETTY_EPOLL_ENABLE_KEY; /** * {@link NettyEventLoopFactory} */ -public class NettyEventLoopFactoryTest { +class NettyEventLoopFactoryTest { @BeforeEach public void setUp() { diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyTransporterTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyTransporterTest.java index c75585707e..17b0db79f2 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyTransporterTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/NettyTransporterTest.java @@ -32,9 +32,9 @@ import java.util.concurrent.CountDownLatch; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -public class NettyTransporterTest { +class NettyTransporterTest { @Test - public void shouldAbleToBindNetty4() throws Exception { + void shouldAbleToBindNetty4() throws Exception { int port = NetUtils.getAvailablePort(); URL url = new ServiceConfigURL("telnet", "localhost", port, new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)}); @@ -45,7 +45,7 @@ public class NettyTransporterTest { } @Test - public void shouldConnectToNetty4Server() throws Exception { + void shouldConnectToNetty4Server() throws Exception { final CountDownLatch lock = new CountDownLatch(1); int port = NetUtils.getAvailablePort(); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/PortUnificationExchangerTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/PortUnificationExchangerTest.java index ab9e1f4628..f06c018f3e 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/PortUnificationExchangerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/PortUnificationExchangerTest.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -public class PortUnificationExchangerTest { +class PortUnificationExchangerTest { private static URL url; diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/PortUnificationServerTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/PortUnificationServerTest.java index 60b5b53b55..61273baf4c 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/PortUnificationServerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/PortUnificationServerTest.java @@ -24,10 +24,10 @@ import org.apache.dubbo.remoting.api.pu.DefaultPuHandler; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class PortUnificationServerTest { +class PortUnificationServerTest { @Test - public void testBind() throws RemotingException { + void testBind() throws RemotingException { int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("empty://127.0.0.1:" + port + "?foo=bar"); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java index d8296a6845..5d76aa0099 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java @@ -45,7 +45,7 @@ import static org.junit.jupiter.api.Assertions.fail; * ReplierDispatcherTest */ -public class ReplierDispatcherTest { +class ReplierDispatcherTest { private ExchangeServer exchangeServer; @@ -64,7 +64,7 @@ public class ReplierDispatcherTest { @Test - public void testDataPackage() throws Exception { + void testDataPackage() throws Exception { ExchangeChannel client = Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?" + CommonConstants.TIMEOUT_KEY + "=60000")); Random random = new Random(); for (int i = 5; i < 100; i++) { @@ -80,7 +80,7 @@ public class ReplierDispatcherTest { @Test - public void testMultiThread() throws Exception { + void testMultiThread() throws Exception { int tc = 10; ExecutorService exec = Executors.newFixedThreadPool(tc); for (int i = 0; i < tc; i++) diff --git a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClientTest.java b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClientTest.java index 88b99db6a9..870f8f1b35 100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClientTest.java +++ b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClientTest.java @@ -39,7 +39,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.Mockito.mock; -public class Curator5ZookeeperClientTest { +class Curator5ZookeeperClientTest { private static Curator5ZookeeperClient curatorClient; private static CuratorFramework client = null; @@ -56,7 +56,7 @@ public class Curator5ZookeeperClientTest { } @Test - public void testCheckExists() { + void testCheckExists() { String path = "/dubbo/org.apache.dubbo.demo.DemoService/providers"; curatorClient.create(path, false); assertThat(curatorClient.checkExists(path), is(true)); @@ -64,7 +64,7 @@ public class Curator5ZookeeperClientTest { } @Test - public void testChildrenPath() { + void testChildrenPath() { String path = "/dubbo/org.apache.dubbo.demo.DemoService/providers"; curatorClient.create(path, false); curatorClient.create(path + "/provider1", false); @@ -93,7 +93,7 @@ public class Curator5ZookeeperClientTest { @Test - public void testWithInvalidServer() { + void testWithInvalidServer() { Assertions.assertThrows(IllegalStateException.class, () -> { curatorClient = new Curator5ZookeeperClient(URL.valueOf("zookeeper://127.0.0.1:1/service?timeout=1000")); curatorClient.create("/testPath", true); @@ -101,27 +101,27 @@ public class Curator5ZookeeperClientTest { } @Test - public void testRemoveChildrenListener() { + void testRemoveChildrenListener() { ChildListener childListener = mock(ChildListener.class); curatorClient.addChildListener("/children", childListener); curatorClient.removeChildListener("/children", childListener); } @Test - public void testCreateExistingPath() { + void testCreateExistingPath() { curatorClient.create("/pathOne", false); curatorClient.create("/pathOne", false); } @Test - public void testConnectedStatus() { + void testConnectedStatus() { curatorClient.createEphemeral("/testPath"); boolean connected = curatorClient.isConnected(); assertThat(connected, is(true)); } @Test - public void testCreateContent4Persistent() { + void testCreateContent4Persistent() { String path = "/curatorTest4CrContent/content.data"; String content = "createContentTest"; curatorClient.delete(path); @@ -134,7 +134,7 @@ public class Curator5ZookeeperClientTest { } @Test - public void testCreateContent4Temp() { + void testCreateContent4Temp() { String path = "/curatorTest4CrContent/content.data"; String content = "createContentTest"; curatorClient.delete(path); @@ -147,7 +147,7 @@ public class Curator5ZookeeperClientTest { } @Test - public void testAddTargetDataListener() throws Exception { + void testAddTargetDataListener() throws Exception { String listenerPath = "/dubbo/service.name/configuration"; String path = listenerPath + "/dat/data"; String value = "vav"; diff --git a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperTransporterTest.java b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperTransporterTest.java index 34fde8fa38..a6b3f062df 100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperTransporterTest.java +++ b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperTransporterTest.java @@ -27,7 +27,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.nullValue; -public class Curator5ZookeeperTransporterTest { +class Curator5ZookeeperTransporterTest { private ZookeeperClient zookeeperClient; private Curator5ZookeeperTransporter curatorZookeeperTransporter; private static String zookeeperConnectionAddress1; @@ -44,7 +44,7 @@ public class Curator5ZookeeperTransporterTest { } @Test - public void testZookeeperClient() { + void testZookeeperClient() { assertThat(zookeeperClient, not(nullValue())); zookeeperClient.close(); } diff --git a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/support/AbstractZookeeperTransporterTest.java b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/support/AbstractZookeeperTransporterTest.java index 0f43c0d10b..043ba1c33d 100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/support/AbstractZookeeperTransporterTest.java +++ b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/support/AbstractZookeeperTransporterTest.java @@ -35,7 +35,7 @@ import static org.hamcrest.core.IsNull.nullValue; /** * AbstractZookeeperTransporterTest */ -public class AbstractZookeeperTransporterTest { +class AbstractZookeeperTransporterTest { private ZookeeperClient zookeeperClient; private AbstractZookeeperTransporter abstractZookeeperTransporter; @@ -57,13 +57,13 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testZookeeperClient() { + void testZookeeperClient() { assertThat(zookeeperClient, not(nullValue())); zookeeperClient.close(); } @Test - public void testGetURLBackupAddress() { + void testGetURLBackupAddress() { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + 9099 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); List stringList = abstractZookeeperTransporter.getURLBackupAddress(url); Assertions.assertEquals(stringList.size(), 2); @@ -72,7 +72,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testGetURLBackupAddressNoBack() { + void testGetURLBackupAddressNoBack() { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); List stringList = abstractZookeeperTransporter.getURLBackupAddress(url); Assertions.assertEquals(stringList.size(), 1); @@ -80,7 +80,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testFetchAndUpdateZookeeperClientCache() throws Exception { + void testFetchAndUpdateZookeeperClientCache() throws Exception { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + ",127.0.0.1:" + zookeeperServerPort2 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url); //just for connected @@ -101,7 +101,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testRepeatConnect() { + void testRepeatConnect() { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); URL url2 = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true"); ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url); @@ -120,7 +120,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testNotRepeatConnect() throws Exception { + void testNotRepeatConnect() throws Exception { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); URL url2 = URL.valueOf(zookeeperConnectionAddress2 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true"); ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url); @@ -139,7 +139,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testRepeatConnectForBackUpAdd() throws Exception { + void testRepeatConnectForBackUpAdd() throws Exception { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); URL url2 = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.metadata.store.MetadataReport?backup=127.0.0.1:" + zookeeperServerPort2 + "&address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true"); @@ -159,7 +159,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testRepeatConnectForNoMatchBackUpAdd() throws Exception { + void testRepeatConnectForNoMatchBackUpAdd() throws Exception { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); URL url2 = URL.valueOf(zookeeperConnectionAddress2 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true"); @@ -179,7 +179,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testSameHostWithDifferentUser() throws Exception { + void testSameHostWithDifferentUser() throws Exception { URL url1 = URL.valueOf("zookeeper://us1:pw1@127.0.0.1:" + zookeeperServerPort1 + "/path1"); URL url2 = URL.valueOf("zookeeper://us2:pw2@127.0.0.1:" + zookeeperServerPort1 + "/path2"); ZookeeperClient client1 = abstractZookeeperTransporter.connect(url1); diff --git a/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClientTest.java b/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClientTest.java index c647957c24..8bc23b47b7 100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClientTest.java +++ b/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClientTest.java @@ -44,7 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.Mockito.mock; @DisabledForJreRange(min = JRE.JAVA_16) -public class CuratorZookeeperClientTest { +class CuratorZookeeperClientTest { private CuratorZookeeperClient curatorClient; CuratorFramework client = null; @@ -65,7 +65,7 @@ public class CuratorZookeeperClientTest { } @Test - public void testCheckExists() { + void testCheckExists() { String path = "/dubbo/org.apache.dubbo.demo.DemoService/providers"; curatorClient.create(path, false); assertThat(curatorClient.checkExists(path), is(true)); @@ -73,7 +73,7 @@ public class CuratorZookeeperClientTest { } @Test - public void testChildrenPath() { + void testChildrenPath() { String path = "/dubbo/org.apache.dubbo.demo.DemoService/providers"; curatorClient.create(path, false); curatorClient.create(path + "/provider1", false); @@ -102,7 +102,7 @@ public class CuratorZookeeperClientTest { @Test - public void testWithInvalidServer() { + void testWithInvalidServer() { Assertions.assertThrows(IllegalStateException.class, () -> { curatorClient = new CuratorZookeeperClient(URL.valueOf("zookeeper://127.0.0.1:1/service")); curatorClient.create("/testPath", true); @@ -119,27 +119,27 @@ public class CuratorZookeeperClientTest { } @Test - public void testRemoveChildrenListener() { + void testRemoveChildrenListener() { ChildListener childListener = mock(ChildListener.class); curatorClient.addChildListener("/children", childListener); curatorClient.removeChildListener("/children", childListener); } @Test - public void testCreateExistingPath() { + void testCreateExistingPath() { curatorClient.create("/pathOne", false); curatorClient.create("/pathOne", false); } @Test - public void testConnectedStatus() { + void testConnectedStatus() { curatorClient.createEphemeral("/testPath"); boolean connected = curatorClient.isConnected(); assertThat(connected, is(true)); } @Test - public void testCreateContent4Persistent() { + void testCreateContent4Persistent() { String path = "/curatorTest4CrContent/content.data"; String content = "createContentTest"; curatorClient.delete(path); @@ -152,7 +152,7 @@ public class CuratorZookeeperClientTest { } @Test - public void testCreateContent4Temp() { + void testCreateContent4Temp() { String path = "/curatorTest4CrContent/content.data"; String content = "createContentTest"; curatorClient.delete(path); @@ -170,7 +170,7 @@ public class CuratorZookeeperClientTest { } @Test - public void testAddTargetDataListener() throws Exception { + void testAddTargetDataListener() throws Exception { String listenerPath = "/dubbo/service.name/configuration"; String path = listenerPath + "/dat/data"; String value = "vav"; diff --git a/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperTransporterTest.java b/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperTransporterTest.java index dd5a3d9f04..8831ab6527 100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperTransporterTest.java +++ b/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperTransporterTest.java @@ -30,7 +30,7 @@ import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.nullValue; @DisabledForJreRange(min = JRE.JAVA_16) -public class CuratorZookeeperTransporterTest { +class CuratorZookeeperTransporterTest { private ZookeeperClient zookeeperClient; private CuratorZookeeperTransporter curatorZookeeperTransporter; private static String zookeeperConnectionAddress1; @@ -47,7 +47,7 @@ public class CuratorZookeeperTransporterTest { } @Test - public void testZookeeperClient() { + void testZookeeperClient() { assertThat(zookeeperClient, not(nullValue())); zookeeperClient.close(); } diff --git a/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/support/AbstractZookeeperTransporterTest.java b/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/support/AbstractZookeeperTransporterTest.java index a23f4ca6a3..bab6987656 100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/support/AbstractZookeeperTransporterTest.java +++ b/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/support/AbstractZookeeperTransporterTest.java @@ -38,7 +38,7 @@ import static org.hamcrest.core.IsNull.nullValue; * AbstractZookeeperTransporterTest */ @DisabledForJreRange(min = JRE.JAVA_16) -public class AbstractZookeeperTransporterTest { +class AbstractZookeeperTransporterTest { private ZookeeperClient zookeeperClient; private AbstractZookeeperTransporter abstractZookeeperTransporter; @@ -61,13 +61,13 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testZookeeperClient() { + void testZookeeperClient() { assertThat(zookeeperClient, not(nullValue())); zookeeperClient.close(); } @Test - public void testGetURLBackupAddress() { + void testGetURLBackupAddress() { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + 9099 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); List stringList = abstractZookeeperTransporter.getURLBackupAddress(url); Assertions.assertEquals(stringList.size(), 2); @@ -76,7 +76,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testGetURLBackupAddressNoBack() { + void testGetURLBackupAddressNoBack() { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); List stringList = abstractZookeeperTransporter.getURLBackupAddress(url); Assertions.assertEquals(stringList.size(), 1); @@ -84,7 +84,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testFetchAndUpdateZookeeperClientCache() throws Exception { + void testFetchAndUpdateZookeeperClientCache() throws Exception { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + ",127.0.0.1:" + zookeeperServerPort2 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url); //just for connected @@ -105,7 +105,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testRepeatConnect() { + void testRepeatConnect() { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); URL url2 = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true"); ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url); @@ -124,7 +124,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testNotRepeatConnect() throws Exception { + void testNotRepeatConnect() throws Exception { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); URL url2 = URL.valueOf(zookeeperConnectionAddress2 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true"); ZookeeperClient newZookeeperClient = abstractZookeeperTransporter.connect(url); @@ -143,7 +143,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testRepeatConnectForBackUpAdd() throws Exception { + void testRepeatConnectForBackUpAdd() throws Exception { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); URL url2 = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.metadata.store.MetadataReport?backup=127.0.0.1:" + zookeeperServerPort2 + "&address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true"); @@ -163,7 +163,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testRepeatConnectForNoMatchBackUpAdd() throws Exception { + void testRepeatConnectForNoMatchBackUpAdd() throws Exception { URL url = URL.valueOf(zookeeperConnectionAddress1 + "/org.apache.dubbo.registry.RegistryService?backup=127.0.0.1:" + zookeeperServerPort1 + "&application=metadatareport-local-xml-provider2&dubbo=2.0.2&interface=org.apache.dubbo.registry.RegistryService&pid=47418&specVersion=2.7.0-SNAPSHOT×tamp=1547102428828"); URL url2 = URL.valueOf(zookeeperConnectionAddress2 + "/org.apache.dubbo.metadata.store.MetadataReport?address=zookeeper://127.0.0.1:2181&application=metadatareport-local-xml-provider2&cycle-report=false&interface=org.apache.dubbo.metadata.store.MetadataReport&retry-period=4590&retry-times=23&sync-report=true"); @@ -183,7 +183,7 @@ public class AbstractZookeeperTransporterTest { } @Test - public void testSameHostWithDifferentUser() throws Exception { + void testSameHostWithDifferentUser() throws Exception { URL url1 = URL.valueOf("zookeeper://us1:pw1@127.0.0.1:" + zookeeperServerPort1 + "/path1"); URL url2 = URL.valueOf("zookeeper://us2:pw2@127.0.0.1:" + zookeeperServerPort1 + "/path2"); ZookeeperClient client1 = abstractZookeeperTransporter.connect(url1); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/AppResponseTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/AppResponseTest.java index aee142ac2e..df26ab2402 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/AppResponseTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/AppResponseTest.java @@ -16,16 +16,16 @@ */ package org.apache.dubbo.rpc; -import static org.junit.jupiter.api.Assumptions.assumeFalse; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.util.HashMap; -public class AppResponseTest { +import static org.junit.jupiter.api.Assumptions.assumeFalse; + +class AppResponseTest { @Test - public void testAppResponseWithNormalException() { + void testAppResponseWithNormalException() { NullPointerException npe = new NullPointerException(); AppResponse appResponse = new AppResponse(npe); @@ -38,7 +38,7 @@ public class AppResponseTest { * please run this test in Run mode */ @Test - public void testAppResponseWithEmptyStackTraceException() { + void testAppResponseWithEmptyStackTraceException() { Throwable throwable = buildEmptyStackTraceException(); assumeFalse(throwable == null); AppResponse appResponse = new AppResponse(throwable); @@ -49,7 +49,7 @@ public class AppResponseTest { } @Test - public void testSetExceptionWithNormalException() { + void testSetExceptionWithNormalException() { NullPointerException npe = new NullPointerException(); AppResponse appResponse = new AppResponse(); appResponse.setException(npe); @@ -63,7 +63,7 @@ public class AppResponseTest { * please run this test in Run mode */ @Test - public void testSetExceptionWithEmptyStackTraceException() { + void testSetExceptionWithEmptyStackTraceException() { Throwable throwable = buildEmptyStackTraceException(); assumeFalse(throwable == null); AppResponse appResponse = new AppResponse(); @@ -101,7 +101,7 @@ public class AppResponseTest { } @Test - public void testObjectAttachment() { + void testObjectAttachment() { AppResponse response = new AppResponse(); response.setAttachment("objectKey1", "value1"); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/CancellationContextTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/CancellationContextTest.java index aeffbcb471..f6fd20b09d 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/CancellationContextTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/CancellationContextTest.java @@ -25,10 +25,10 @@ import java.util.concurrent.CountDownLatch; /** * {@link CancellationContext} */ -public class CancellationContextTest { +class CancellationContextTest { @Test - public void test() throws Exception { + void test() throws Exception { CancellationContext cancellationContext = new CancellationContext(); CountDownLatch latch = new CountDownLatch(2); @@ -47,7 +47,7 @@ public class CancellationContextTest { } @Test - public void testAddListenerAfterCancel() throws Exception { + void testAddListenerAfterCancel() throws Exception { CancellationContext cancellationContext = new CancellationContext(); cancellationContext.cancel(null); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/FutureContextTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/FutureContextTest.java index 1a907dca98..df2d19b394 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/FutureContextTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/FutureContextTest.java @@ -24,10 +24,10 @@ import java.util.concurrent.CompletableFuture; /** * */ -public class FutureContextTest { +class FutureContextTest { @Test - public void testFutureContext() throws Exception { + void testFutureContext() throws Exception { Thread thread1 = new Thread(() -> { FutureContext.getContext().setFuture(CompletableFuture.completedFuture("future from thread1")); try { diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/PenetrateAttachmentSelectorTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/PenetrateAttachmentSelectorTest.java index 5490204bf4..21ff35c2b4 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/PenetrateAttachmentSelectorTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/PenetrateAttachmentSelectorTest.java @@ -30,10 +30,10 @@ import java.util.Set; /** * {@link PenetrateAttachmentSelector} */ -public class PenetrateAttachmentSelectorTest { +class PenetrateAttachmentSelectorTest { @Test - public void test() { + void test() { ExtensionLoader selectorExtensionLoader = ApplicationModel.defaultModel().getExtensionLoader(PenetrateAttachmentSelector.class); Set supportedSelectors = selectorExtensionLoader.getSupportedExtensions(); Map allSelected = new HashMap<>(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcContextTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcContextTest.java index 0d2d22d0d0..b6ceac8342 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcContextTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcContextTest.java @@ -30,10 +30,10 @@ import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -public class RpcContextTest { +class RpcContextTest { @Test - public void testGetContext() { + void testGetContext() { RpcContext rpcContext = RpcContext.getClientAttachment(); Assertions.assertNotNull(rpcContext); @@ -53,7 +53,7 @@ public class RpcContextTest { } @Test - public void testAddress() { + void testAddress() { RpcContext context = RpcContext.getServiceContext(); context.setLocalAddress("127.0.0.1", 20880); Assertions.assertEquals(20880, context.getLocalAddress().getPort()); @@ -72,7 +72,7 @@ public class RpcContextTest { } @Test - public void testCheckSide() { + void testCheckSide() { RpcContext context = RpcContext.getServiceContext(); @@ -89,7 +89,7 @@ public class RpcContextTest { } @Test - public void testAttachments() { + void testAttachments() { RpcContext context = RpcContext.getClientAttachment(); Map map = new HashMap<>(); @@ -117,7 +117,7 @@ public class RpcContextTest { } @Test - public void testObject() { + void testObject() { RpcContext context = RpcContext.getClientAttachment(); Map map = new HashMap(); @@ -147,7 +147,7 @@ public class RpcContextTest { } @Test - public void testAsync() { + void testAsync() { RpcContext rpcContext = RpcContext.getServiceContext(); Assertions.assertFalse(rpcContext.isAsyncStarted()); @@ -164,7 +164,7 @@ public class RpcContextTest { } @Test - public void testAsyncCall() { + void testAsyncCall() { CompletableFuture rpcFuture = RpcContext.getClientAttachment().asyncCall(() -> { throw new NullPointerException(); }); @@ -184,7 +184,7 @@ public class RpcContextTest { } @Test - public void testObjectAttachment() { + void testObjectAttachment() { RpcContext rpcContext = RpcContext.getClientAttachment(); rpcContext.setAttachment("objectKey1", "value1"); @@ -217,7 +217,7 @@ public class RpcContextTest { } @Test - public void testRestore() { + void testRestore() { } diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcInvocationTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcInvocationTest.java index 168a42a8a8..4c226f3d0c 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcInvocationTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcInvocationTest.java @@ -21,10 +21,10 @@ import org.junit.jupiter.api.Test; import java.util.HashMap; -public class RpcInvocationTest { +class RpcInvocationTest { @Test - public void testAttachment() { + void testAttachment() { RpcInvocation invocation = new RpcInvocation(); invocation.setAttachment("objectKey1", "value1"); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcStatusTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcStatusTest.java index 0498885b69..0ed74bf531 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcStatusTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/RpcStatusTest.java @@ -32,10 +32,10 @@ import java.util.concurrent.atomic.AtomicInteger; /** * {@link RpcStatus} */ -public class RpcStatusTest { +class RpcStatusTest { @Test - public void testBeginCountEndCount() { + void testBeginCountEndCount() { URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 91031, DemoService.class.getName()); String methodName = "testBeginCountEndCount"; int max = 2; @@ -63,7 +63,7 @@ public class RpcStatusTest { } @Test - public void testBeginCountEndCountInMultiThread() throws Exception { + void testBeginCountEndCountInMultiThread() throws Exception { URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 91032, DemoService.class.getName()); String methodName = "testBeginCountEndCountInMultiThread"; int max = 50; @@ -97,7 +97,7 @@ public class RpcStatusTest { } @Test - public void testStatistics() { + void testStatistics() { URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 91033, DemoService.class.getName()); String methodName = "testStatistics"; int max = 0; diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/TimeoutCountDownTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/TimeoutCountDownTest.java index cfb7162e8c..5a37f30743 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/TimeoutCountDownTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/TimeoutCountDownTest.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; import java.util.concurrent.TimeUnit; -public class TimeoutCountDownTest { +class TimeoutCountDownTest { @Test - public void testTimeoutCountDown() throws InterruptedException { + void testTimeoutCountDown() throws InterruptedException { TimeoutCountDown timeoutCountDown = TimeoutCountDown.newCountDown(5, TimeUnit.SECONDS); Assertions.assertEquals(5 * 1000, timeoutCountDown.getTimeoutInMilli()); Assertions.assertFalse(timeoutCountDown.isExpired()); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/AccessLogFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/AccessLogFilterTest.java index fb58a69fdc..390f5d837e 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/AccessLogFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/AccessLogFilterTest.java @@ -39,13 +39,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue; /** * AccessLogFilterTest.java */ -public class AccessLogFilterTest { +class AccessLogFilterTest { Filter accessLogFilter = new AccessLogFilter(); // Test filter won't throw an exception @Test - public void testInvokeException() { + void testInvokeException() { Invoker invoker = new MyInvoker(null); Invocation invocation = new MockInvocation(); LogUtil.start(); @@ -77,7 +77,7 @@ public class AccessLogFilterTest { } @Test - public void testCustom() { + void testCustom() { URL url = URL.valueOf("test://test:11/test?accesslog=custom-access.log"); Invoker invoker = new MyInvoker(url); Invocation invocation = new MockInvocation(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ActiveLimitFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ActiveLimitFilterTest.java index 7f741f1bcd..c445b8e8ed 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ActiveLimitFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ActiveLimitFilterTest.java @@ -40,12 +40,12 @@ import static org.junit.jupiter.api.Assertions.fail; /** * ActiveLimitFilterTest.java */ -public class ActiveLimitFilterTest { +class ActiveLimitFilterTest { ActiveLimitFilter activeLimitFilter = new ActiveLimitFilter(); @Test - public void testInvokeNoActives() { + void testInvokeNoActives() { URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1&actives=0"); Invoker invoker = new MyInvoker(url); Invocation invocation = new MockInvocation(); @@ -53,7 +53,7 @@ public class ActiveLimitFilterTest { } @Test - public void testInvokeLessActives() { + void testInvokeLessActives() { URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1&actives=10"); Invoker invoker = new MyInvoker(url); Invocation invocation = new MockInvocation(); @@ -61,7 +61,7 @@ public class ActiveLimitFilterTest { } @Test - public void testInvokeGreaterActives() { + void testInvokeGreaterActives() { AtomicInteger count = new AtomicInteger(0); URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1&actives=1&timeout=1"); final Invoker invoker = new BlockMyInvoker(url, 100); @@ -98,7 +98,7 @@ public class ActiveLimitFilterTest { } @Test - public void testInvokeTimeOut() throws Exception { + void testInvokeTimeOut() throws Exception { int totalThread = 100; int maxActives = 10; long timeout = 1; @@ -147,7 +147,7 @@ public class ActiveLimitFilterTest { } @Test - public void testInvokeNotTimeOut() throws Exception { + void testInvokeNotTimeOut() throws Exception { int totalThread = 100; int maxActives = 10; long timeout = 1000; @@ -195,7 +195,7 @@ public class ActiveLimitFilterTest { } @Test - public void testInvokeRuntimeException() { + void testInvokeRuntimeException() { Assertions.assertThrows(RuntimeException.class, () -> { URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1&actives=0"); Invoker invoker = new RuntimeExceptionInvoker(url); @@ -209,7 +209,7 @@ public class ActiveLimitFilterTest { } @Test - public void testInvokeRuntimeExceptionWithActiveCountMatch() { + void testInvokeRuntimeExceptionWithActiveCountMatch() { URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1&actives=0"); Invoker invoker = new RuntimeExceptionInvoker(url); Invocation invocation = new MockInvocation(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ClassLoaderFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ClassLoaderFilterTest.java index 4bbcedf0bd..a133ea327b 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ClassLoaderFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ClassLoaderFilterTest.java @@ -32,12 +32,12 @@ import org.mockito.Mockito; import java.net.URLClassLoader; -public class ClassLoaderFilterTest { +class ClassLoaderFilterTest { private ClassLoaderFilter classLoaderFilter = new ClassLoaderFilter(); @Test - public void testInvoke() throws Exception { + void testInvoke() throws Exception { URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1"); String path = DemoService.class.getResource("/").getPath(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/CompatibleFilterFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/CompatibleFilterFilterTest.java index 9a5152bc6a..d07d58452d 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/CompatibleFilterFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/CompatibleFilterFilterTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock; /** * CompatibleFilterTest.java */ -public class CompatibleFilterFilterTest { +class CompatibleFilterFilterTest { private CompatibleFilter compatibleFilter = new CompatibleFilter(); private Invocation invocation; private Invoker invoker; @@ -49,7 +49,7 @@ public class CompatibleFilterFilterTest { } @Test - public void testInvokerGeneric() { + void testInvokerGeneric() { invocation = mock(RpcInvocation.class); given(invocation.getMethodName()).willReturn("$enumlength"); given(invocation.getParameterTypes()).willReturn(new Class[]{Enum.class}); @@ -69,7 +69,7 @@ public class CompatibleFilterFilterTest { } @Test - public void testResultHasException() { + void testResultHasException() { invocation = mock(RpcInvocation.class); given(invocation.getMethodName()).willReturn("enumlength"); given(invocation.getParameterTypes()).willReturn(new Class[]{Enum.class}); @@ -90,7 +90,7 @@ public class CompatibleFilterFilterTest { } @Test - public void testInvokerJsonPojoSerialization() throws Exception { + void testInvokerJsonPojoSerialization() throws Exception { invocation = mock(RpcInvocation.class); given(invocation.getMethodName()).willReturn("enumlength"); given(invocation.getParameterTypes()).willReturn(new Class[]{Type[].class}); @@ -113,7 +113,7 @@ public class CompatibleFilterFilterTest { } @Test - public void testInvokerNonJsonEnumSerialization() throws Exception { + void testInvokerNonJsonEnumSerialization() throws Exception { invocation = mock(RpcInvocation.class); given(invocation.getMethodName()).willReturn("enumlength"); given(invocation.getParameterTypes()).willReturn(new Class[]{Type[].class}); @@ -136,7 +136,7 @@ public class CompatibleFilterFilterTest { } @Test - public void testInvokerNonJsonNonPojoSerialization() { + void testInvokerNonJsonNonPojoSerialization() { invocation = mock(RpcInvocation.class); given(invocation.getMethodName()).willReturn("echo"); given(invocation.getParameterTypes()).willReturn(new Class[]{String.class}); @@ -156,7 +156,7 @@ public class CompatibleFilterFilterTest { } @Test - public void testInvokerNonJsonPojoSerialization() { + void testInvokerNonJsonPojoSerialization() { invocation = mock(RpcInvocation.class); given(invocation.getMethodName()).willReturn("echo"); given(invocation.getParameterTypes()).willReturn(new Class[]{String.class}); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ContextFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ContextFilterTest.java index ae9549bfee..6bab37aab6 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ContextFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ContextFilterTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock; * ContextFilterTest.java * TODO need to enhance assertion */ -public class ContextFilterTest { +class ContextFilterTest { Filter contextFilter = new ContextFilter(ApplicationModel.defaultModel()); Invoker invoker; @@ -46,7 +46,7 @@ public class ContextFilterTest { @SuppressWarnings("unchecked") @Test - public void testSetContext() { + void testSetContext() { invocation = mock(Invocation.class); given(invocation.getMethodName()).willReturn("$enumlength"); given(invocation.getParameterTypes()).willReturn(new Class[]{Enum.class}); @@ -67,7 +67,7 @@ public class ContextFilterTest { } @Test - public void testWithAttachments() { + void testWithAttachments() { URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1"); Invoker invoker = new MyInvoker(url); Invocation invocation = new MockInvocation(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/DeprecatedFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/DeprecatedFilterTest.java index 2e1926473d..8809dc8ba8 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/DeprecatedFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/DeprecatedFilterTest.java @@ -32,12 +32,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * DeprecatedFilterTest.java */ -public class DeprecatedFilterTest { +class DeprecatedFilterTest { Filter deprecatedFilter = new DeprecatedFilter(); @Test - public void testDeprecatedFilter() { + void testDeprecatedFilter() { URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1&echo." + DEPRECATED_KEY + "=true"); LogUtil.start(); deprecatedFilter.invoke(new MyInvoker(url), new MockInvocation()); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/EchoFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/EchoFilterTest.java index b31d22595a..2c67db6ffc 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/EchoFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/EchoFilterTest.java @@ -31,13 +31,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -public class EchoFilterTest { +class EchoFilterTest { Filter echoFilter = new EchoFilter(); @SuppressWarnings("unchecked") @Test - public void testEcho() { + void testEcho() { Invocation invocation = mock(RpcInvocation.class); given(invocation.getMethodName()).willReturn("$echo"); given(invocation.getParameterTypes()).willReturn(new Class[]{Enum.class}); @@ -59,7 +59,7 @@ public class EchoFilterTest { @SuppressWarnings("unchecked") @Test - public void testNonEcho() { + void testNonEcho() { Invocation invocation = mock(Invocation.class); given(invocation.getMethodName()).willReturn("echo"); given(invocation.getParameterTypes()).willReturn(new Class[]{Enum.class}); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ExceptionFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ExceptionFilterTest.java index 0f496cdf22..b2cae229e9 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ExceptionFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/ExceptionFilterTest.java @@ -42,11 +42,11 @@ import static org.mockito.Mockito.when; /** * ExceptionFilterTest */ -public class ExceptionFilterTest { +class ExceptionFilterTest { @SuppressWarnings("unchecked") @Test - public void testRpcException() { + void testRpcException() { Logger failLogger = mock(Logger.class); FailsafeErrorTypeAwareLogger failsafeLogger = new FailsafeErrorTypeAwareLogger(failLogger); RpcContext.getServiceContext().setRemoteAddress("127.0.0.1", 1234); @@ -74,7 +74,7 @@ public class ExceptionFilterTest { @SuppressWarnings("unchecked") @Test - public void testJavaException() { + void testJavaException() { ExceptionFilter exceptionFilter = new ExceptionFilter(); RpcInvocation invocation = new RpcInvocation("sayHello", DemoService.class.getName(), "", new Class[]{String.class}, new Object[]{"world"}); @@ -94,7 +94,7 @@ public class ExceptionFilterTest { @SuppressWarnings("unchecked") @Test - public void testRuntimeException() { + void testRuntimeException() { ExceptionFilter exceptionFilter = new ExceptionFilter(); RpcInvocation invocation = new RpcInvocation("sayHello", DemoService.class.getName(), "", new Class[]{String.class}, new Object[]{"world"}); @@ -114,7 +114,7 @@ public class ExceptionFilterTest { @SuppressWarnings("unchecked") @Test - public void testConvertToRunTimeException() throws Exception { + void testConvertToRunTimeException() throws Exception { ExceptionFilter exceptionFilter = new ExceptionFilter(); RpcInvocation invocation = new RpcInvocation("sayHello", DemoService.class.getName(), "", new Class[]{String.class}, new Object[]{"world"}); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericFilterTest.java index e2d2b3dea2..17f26e1005 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericFilterTest.java @@ -43,11 +43,11 @@ import static org.apache.dubbo.rpc.Constants.GENERIC_KEY; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; -public class GenericFilterTest { +class GenericFilterTest { GenericFilter genericFilter = new GenericFilter(); @Test - public void testInvokeWithDefault() throws Exception { + void testInvokeWithDefault() throws Exception { Method genericInvoke = GenericService.class.getMethods()[0]; @@ -75,7 +75,7 @@ public class GenericFilterTest { } @Test - public void testInvokeWithJavaException() throws Exception { + void testInvokeWithJavaException() throws Exception { // temporary enable native java generic serialize System.setProperty(ENABLE_NATIVE_JAVA_GENERIC_SERIALIZE, "true"); Assertions.assertThrows(RpcException.class, () -> { @@ -102,7 +102,7 @@ public class GenericFilterTest { } @Test - public void testInvokeWithMethodNamtNot$Invoke() { + void testInvokeWithMethodNamtNot$Invoke() { Method genericInvoke = GenericService.class.getMethods()[0]; @@ -126,7 +126,7 @@ public class GenericFilterTest { } @Test - public void testInvokeWithMethodArgumentSizeIsNot3() { + void testInvokeWithMethodArgumentSizeIsNot3() { Method genericInvoke = GenericService.class.getMethods()[0]; diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericImplFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericImplFilterTest.java index b7828aac31..e8d92245c8 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericImplFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/GenericImplFilterTest.java @@ -41,12 +41,12 @@ import static org.apache.dubbo.rpc.Constants.GENERIC_KEY; import static org.mockito.Mockito.any; import static org.mockito.Mockito.when; -public class GenericImplFilterTest { +class GenericImplFilterTest { private GenericImplFilter genericImplFilter = new GenericImplFilter(); @Test - public void testInvoke() throws Exception { + void testInvoke() throws Exception { RpcInvocation invocation = new RpcInvocation("getPerson", "org.apache.dubbo.rpc.support.DemoService", "org.apache.dubbo.rpc.support.DemoService:dubbo", new Class[]{Person.class}, new Object[]{new Person("dubbo", 10)}); @@ -74,7 +74,7 @@ public class GenericImplFilterTest { } @Test - public void testInvokeWithException() throws Exception { + void testInvokeWithException() throws Exception { RpcInvocation invocation = new RpcInvocation("getPerson", "org.apache.dubbo.rpc.support.DemoService", "org.apache.dubbo.rpc.support.DemoService:dubbo", new Class[]{Person.class}, new Object[]{new Person("dubbo", 10)}); @@ -96,7 +96,7 @@ public class GenericImplFilterTest { } @Test - public void testInvokeWith$Invoke() throws Exception { + void testInvokeWith$Invoke() throws Exception { Method genericInvoke = GenericService.class.getMethods()[0]; diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/TimeoutFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/TimeoutFilterTest.java index 256427377c..dbf0206db9 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/TimeoutFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/TimeoutFilterTest.java @@ -31,12 +31,12 @@ import org.mockito.Mockito; import static org.mockito.Mockito.any; import static org.mockito.Mockito.when; -public class TimeoutFilterTest { +class TimeoutFilterTest { private TimeoutFilter timeoutFilter = new TimeoutFilter(); @Test - public void testInvokeWithoutTimeout() throws Exception { + void testInvokeWithoutTimeout() throws Exception { int timeout = 3000; Invoker invoker = Mockito.mock(Invoker.class); @@ -51,7 +51,7 @@ public class TimeoutFilterTest { } @Test - public void testInvokeWithTimeout() throws Exception { + void testInvokeWithTimeout() throws Exception { int timeout = 100; URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1&timeout=" + timeout); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/TokenFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/TokenFilterTest.java index c31cd67729..e9007ea821 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/TokenFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/TokenFilterTest.java @@ -34,12 +34,12 @@ import static org.apache.dubbo.rpc.Constants.TOKEN_KEY; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; -public class TokenFilterTest { +class TokenFilterTest { private TokenFilter tokenFilter = new TokenFilter(); @Test - public void testInvokeWithToken() throws Exception { + void testInvokeWithToken() throws Exception { String token = "token"; Invoker invoker = Mockito.mock(Invoker.class); @@ -55,7 +55,7 @@ public class TokenFilterTest { } @Test - public void testInvokeWithWrongToken() throws Exception { + void testInvokeWithWrongToken() throws Exception { Assertions.assertThrows(RpcException.class, () -> { String token = "token"; @@ -74,7 +74,7 @@ public class TokenFilterTest { } @Test - public void testInvokeWithoutToken() throws Exception { + void testInvokeWithoutToken() throws Exception { Assertions.assertThrows(RpcException.class, () -> { String token = "token"; diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/DefaultTPSLimiterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/DefaultTPSLimiterTest.java index 31650f6acf..823eec9903 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/DefaultTPSLimiterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/DefaultTPSLimiterTest.java @@ -31,13 +31,13 @@ import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY; import static org.apache.dubbo.rpc.Constants.TPS_LIMIT_INTERVAL_KEY; import static org.apache.dubbo.rpc.Constants.TPS_LIMIT_RATE_KEY; -public class DefaultTPSLimiterTest { +class DefaultTPSLimiterTest { private static final int TEST_LIMIT_RATE = 2; private final DefaultTPSLimiter defaultTPSLimiter = new DefaultTPSLimiter(); @Test - public void testIsAllowable() throws Exception { + void testIsAllowable() throws Exception { Invocation invocation = new MockInvocation(); URL url = URL.valueOf("test://test"); url = url.addParameter(INTERFACE_KEY, "org.apache.dubbo.rpc.file.TpsService"); @@ -49,7 +49,7 @@ public class DefaultTPSLimiterTest { } @Test - public void testIsNotAllowable() throws Exception { + void testIsNotAllowable() throws Exception { Invocation invocation = new MockInvocation(); URL url = URL.valueOf("test://test"); url = url.addParameter(INTERFACE_KEY, "org.apache.dubbo.rpc.file.TpsService"); @@ -65,7 +65,7 @@ public class DefaultTPSLimiterTest { } @Test - public void testTPSLimiterForMethodLevelConfig() throws Exception { + void testTPSLimiterForMethodLevelConfig() throws Exception { Invocation invocation = new MockInvocation(); URL url = URL.valueOf("test://test"); url = url.addParameter(INTERFACE_KEY, "org.apache.dubbo.rpc.file.TpsService"); @@ -83,7 +83,7 @@ public class DefaultTPSLimiterTest { } @Test - public void testConfigChange() throws Exception { + void testConfigChange() throws Exception { Invocation invocation = new MockInvocation(); URL url = URL.valueOf("test://test"); url = url.addParameter(INTERFACE_KEY, "org.apache.dubbo.rpc.file.TpsService"); @@ -102,7 +102,7 @@ public class DefaultTPSLimiterTest { } @Test - public void testMultiThread() throws InterruptedException { + void testMultiThread() throws InterruptedException { Invocation invocation = new MockInvocation(); URL url = URL.valueOf("test://test"); url = url.addParameter(INTERFACE_KEY, "org.apache.dubbo.rpc.file.TpsService"); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/StatItemTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/StatItemTest.java index 440e37b5c7..c820c3a2ae 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/StatItemTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/StatItemTest.java @@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class StatItemTest { +class StatItemTest { private StatItem statItem; @@ -38,7 +38,7 @@ public class StatItemTest { } @Test - public void testIsAllowable() throws Exception { + void testIsAllowable() throws Exception { statItem = new StatItem("test", 5, 1000L); long lastResetTime = statItem.getLastResetTime(); assertTrue(statItem.isAllowable()); @@ -49,7 +49,7 @@ public class StatItemTest { } @Test - public void testAccuracy() throws Exception { + void testAccuracy() throws Exception { final int EXPECTED_RATE = 5; statItem = new StatItem("test", EXPECTED_RATE, 60_000L); for (int i = 1; i <= EXPECTED_RATE; i++) { @@ -61,7 +61,7 @@ public class StatItemTest { } @Test - public void testConcurrency() throws Exception { + void testConcurrency() throws Exception { statItem = new StatItem("test", 100, 100000); List taskList = new ArrayList<>(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/TpsLimitFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/TpsLimitFilterTest.java index 9515278588..18ec0031e2 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/TpsLimitFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/tps/TpsLimitFilterTest.java @@ -31,12 +31,12 @@ import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY; import static org.apache.dubbo.rpc.Constants.TPS_LIMIT_RATE_KEY; import static org.junit.jupiter.api.Assertions.assertTrue; -public class TpsLimitFilterTest { +class TpsLimitFilterTest { private TpsLimitFilter filter = new TpsLimitFilter(); @Test - public void testWithoutCount() throws Exception { + void testWithoutCount() throws Exception { URL url = URL.valueOf("test://test"); url = url.addParameter(INTERFACE_KEY, "org.apache.dubbo.rpc.file.TpsService"); url = url.addParameter(TPS_LIMIT_RATE_KEY, 5); @@ -46,7 +46,7 @@ public class TpsLimitFilterTest { } @Test - public void testFail() throws Exception { + void testFail() throws Exception { Assertions.assertThrows(RpcException.class, () -> { URL url = URL.valueOf("test://test"); url = url.addParameter(INTERFACE_KEY, "org.apache.dubbo.rpc.file.TpsService"); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/protocol/ProtocolListenerWrapperTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/protocol/ProtocolListenerWrapperTest.java index ead4ede42a..d902559af9 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/protocol/ProtocolListenerWrapperTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/protocol/ProtocolListenerWrapperTest.java @@ -33,10 +33,10 @@ import static org.apache.dubbo.common.constants.CommonConstants.INVOKER_LISTENER import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class ProtocolListenerWrapperTest { +class ProtocolListenerWrapperTest { @Test - public void testLoadingListenerForLocalReference() { + void testLoadingListenerForLocalReference() { // verify that no listener is loaded by default URL urlWithoutListener = URL.valueOf("injvm://127.0.0.1/DemoService") .addParameter(INTERFACE_KEY, DemoService.class.getName()); @@ -78,7 +78,7 @@ public class ProtocolListenerWrapperTest { } @Test - public void testLoadingListenerForRemoteReference() { + void testLoadingListenerForRemoteReference() { // verify that no listener is loaded by default URL urlWithoutListener = URL.valueOf("dubbo://127.0.0.1:20880/DemoService") .addParameter(INTERFACE_KEY, DemoService.class.getName()); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/AbstractProxyTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/AbstractProxyTest.java index 3e95da20f8..5b4de528f7 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/AbstractProxyTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/AbstractProxyTest.java @@ -38,7 +38,7 @@ public abstract class AbstractProxyTest { public static ProxyFactory factory; @Test - public void testGetProxy() throws Exception { + void testGetProxy() throws Exception { URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1"); MyInvoker invoker = new MyInvoker<>(url); @@ -61,7 +61,7 @@ public abstract class AbstractProxyTest { } @Test - public void testGetInvoker() throws Exception { + void testGetInvoker() throws Exception { URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1"); DemoService origin = new DemoServiceImpl(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/InvokerInvocationHandlerTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/InvokerInvocationHandlerTest.java index 03cde675a2..e4b1266de7 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/InvokerInvocationHandlerTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/InvokerInvocationHandlerTest.java @@ -28,7 +28,7 @@ import java.lang.reflect.Method; import static org.mockito.Mockito.when; -public class InvokerInvocationHandlerTest { +class InvokerInvocationHandlerTest { private Invoker invoker; private InvokerInvocationHandler invokerInvocationHandler; @@ -42,7 +42,7 @@ public class InvokerInvocationHandlerTest { } @Test - public void testInvokeToString() throws Throwable { + void testInvokeToString() throws Throwable { String methodName = "toString"; when(invoker.toString()).thenReturn(methodName); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/javassist/JavassistProxyFactoryTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/javassist/JavassistProxyFactoryTest.java index 9bb521df93..b2b0f8f203 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/javassist/JavassistProxyFactoryTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/javassist/JavassistProxyFactoryTest.java @@ -18,7 +18,7 @@ package org.apache.dubbo.rpc.proxy.javassist; import org.apache.dubbo.rpc.proxy.AbstractProxyTest; -public class JavassistProxyFactoryTest extends AbstractProxyTest { +class JavassistProxyFactoryTest extends AbstractProxyTest { static { factory = new JavassistProxyFactory(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/jdk/JdkProxyFactoryTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/jdk/JdkProxyFactoryTest.java index ad1e2851e0..57b401e114 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/jdk/JdkProxyFactoryTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/jdk/JdkProxyFactoryTest.java @@ -18,7 +18,7 @@ package org.apache.dubbo.rpc.proxy.jdk; import org.apache.dubbo.rpc.proxy.AbstractProxyTest; -public class JdkProxyFactoryTest extends AbstractProxyTest { +class JdkProxyFactoryTest extends AbstractProxyTest { static { factory = new JdkProxyFactory(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/wrapper/StubProxyFactoryWrapperTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/wrapper/StubProxyFactoryWrapperTest.java index 947756fe5d..57b50e95e0 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/wrapper/StubProxyFactoryWrapperTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/proxy/wrapper/StubProxyFactoryWrapperTest.java @@ -33,10 +33,10 @@ import static org.apache.dubbo.rpc.Constants.STUB_KEY; /** * {@link StubProxyFactoryWrapper } */ -public class StubProxyFactoryWrapperTest { +class StubProxyFactoryWrapperTest { @Test - public void test() { + void test() { ProxyFactory proxyFactory = Mockito.mock(ProxyFactory.class); Protocol protocol = Mockito.mock(Protocol.class); StubProxyFactoryWrapper stubProxyFactoryWrapper = new StubProxyFactoryWrapper(proxyFactory); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/stub/FutureToObserverAdaptorTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/stub/FutureToObserverAdaptorTest.java index 95e81f2ded..1cfe2784b3 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/stub/FutureToObserverAdaptorTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/stub/FutureToObserverAdaptorTest.java @@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.fail; class FutureToObserverAdaptorTest { @Test - public void testAdapt() throws ExecutionException, InterruptedException, TimeoutException { + void testAdapt() throws ExecutionException, InterruptedException, TimeoutException { CompletableFuture done = CompletableFuture.completedFuture("a"); FutureToObserverAdaptor adaptor = new FutureToObserverAdaptor<>(done); try { diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/MockInvokerTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/MockInvokerTest.java index e1c8f6611f..019b39c3f4 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/MockInvokerTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/MockInvokerTest.java @@ -31,10 +31,10 @@ import java.util.HashMap; import static org.apache.dubbo.rpc.Constants.MOCK_KEY; -public class MockInvokerTest { +class MockInvokerTest { @Test - public void testParseMockValue() throws Exception { + void testParseMockValue() throws Exception { Assertions.assertNull(MockInvoker.parseMockValue("null")); Assertions.assertNull(MockInvoker.parseMockValue("empty")); @@ -55,7 +55,7 @@ public class MockInvokerTest { } @Test - public void testInvoke() { + void testInvoke() { URL url = URL.valueOf("remote://1.2.3.4/" + String.class.getName()); url = url.addParameter(MOCK_KEY, "return "); MockInvoker mockInvoker = new MockInvoker(url, String.class); @@ -67,7 +67,7 @@ public class MockInvokerTest { } @Test - public void testGetDefaultObject() { + void testGetDefaultObject() { // test methodA in DemoServiceAMock final Class demoServiceAClass = DemoServiceA.class; URL url = URL.valueOf("remote://1.2.3.4/" + demoServiceAClass.getName()); @@ -92,7 +92,7 @@ public class MockInvokerTest { @Test - public void testInvokeThrowsRpcException1() { + void testInvokeThrowsRpcException1() { URL url = URL.valueOf("remote://1.2.3.4/" + String.class.getName()); MockInvoker mockInvoker = new MockInvoker(url, null); @@ -101,7 +101,7 @@ public class MockInvokerTest { } @Test - public void testInvokeThrowsRpcException2() { + void testInvokeThrowsRpcException2() { URL url = URL.valueOf("remote://1.2.3.4/" + String.class.getName()); url = url.addParameter(MOCK_KEY, "fail"); MockInvoker mockInvoker = new MockInvoker(url, String.class); @@ -113,7 +113,7 @@ public class MockInvokerTest { } @Test - public void testInvokeThrowsRpcException3() { + void testInvokeThrowsRpcException3() { URL url = URL.valueOf("remote://1.2.3.4/" + String.class.getName()); url = url.addParameter(MOCK_KEY, "throw"); MockInvoker mockInvoker = new MockInvoker(url, String.class); @@ -125,13 +125,13 @@ public class MockInvokerTest { } @Test - public void testGetThrowable() { + void testGetThrowable() { Assertions.assertThrows(RpcException.class, () -> MockInvoker.getThrowable("Exception.class")); } @Test - public void testGetMockObject() { + void testGetMockObject() { Assertions.assertEquals("", MockInvoker.getMockObject(ApplicationModel.defaultModel().getExtensionDirector(), "java.lang.String", String.class)); @@ -146,7 +146,7 @@ public class MockInvokerTest { } @Test - public void testNormalizeMock() { + void testNormalizeMock() { Assertions.assertNull(MockInvoker.normalizeMock(null)); Assertions.assertEquals("", MockInvoker.normalizeMock("")); diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java index f93d896c22..b64a008d1e 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java @@ -44,14 +44,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -public class RpcUtilsTest { +class RpcUtilsTest { /** * regular scenario: async invocation in URL * verify: 1. whether invocationId is set correctly, 2. idempotent or not */ @Test - public void testAttachInvocationIdIfAsync_normal() { + void testAttachInvocationIdIfAsync_normal() { URL url = URL.valueOf("dubbo://localhost/?test.async=true"); Map attachments = new HashMap<>(); attachments.put("aa", "bb"); @@ -70,7 +70,7 @@ public class RpcUtilsTest { * verify: no id attribute added in attachment */ @Test - public void testAttachInvocationIdIfAsync_sync() { + void testAttachInvocationIdIfAsync_sync() { URL url = URL.valueOf("dubbo://localhost/"); Invocation inv = new RpcInvocation("test", "DemoService", "", new Class[] {}, new String[] {}); RpcUtils.attachInvocationIdIfAsync(url, inv); @@ -82,7 +82,7 @@ public class RpcUtilsTest { * verify: no error report when the original attachment is null */ @Test - public void testAttachInvocationIdIfAsync_nullAttachments() { + void testAttachInvocationIdIfAsync_nullAttachments() { URL url = URL.valueOf("dubbo://localhost/?test.async=true"); Invocation inv = new RpcInvocation("test", "DemoService", "", new Class[] {}, new String[] {}); RpcUtils.attachInvocationIdIfAsync(url, inv); @@ -94,7 +94,7 @@ public class RpcUtilsTest { * verify: no id attribute added in attachment */ @Test - public void testAttachInvocationIdIfAsync_forceNotAttache() { + void testAttachInvocationIdIfAsync_forceNotAttache() { URL url = URL.valueOf("dubbo://localhost/?test.async=true&" + AUTO_ATTACH_INVOCATIONID_KEY + "=false"); Invocation inv = new RpcInvocation("test", "DemoService", "", new Class[] {}, new String[] {}); RpcUtils.attachInvocationIdIfAsync(url, inv); @@ -106,7 +106,7 @@ public class RpcUtilsTest { * verify: id attribute added in attachment */ @Test - public void testAttachInvocationIdIfAsync_forceAttache() { + void testAttachInvocationIdIfAsync_forceAttache() { URL url = URL.valueOf("dubbo://localhost/?" + AUTO_ATTACH_INVOCATIONID_KEY + "=true"); Invocation inv = new RpcInvocation("test", "DemoService", "", new Class[] {}, new String[] {}); RpcUtils.attachInvocationIdIfAsync(url, inv); @@ -114,7 +114,7 @@ public class RpcUtilsTest { } @Test - public void testGetReturnType() { + void testGetReturnType() { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); Invoker invoker = mock(Invoker.class); @@ -154,7 +154,7 @@ public class RpcUtilsTest { } @Test - public void testGetReturnTypesUseCache() throws Exception { + void testGetReturnTypesUseCache() throws Exception { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); Invoker invoker = mock(Invoker.class); @@ -218,7 +218,7 @@ public class RpcUtilsTest { } @Test - public void testGetReturnTypesWithoutCache() throws Exception { + void testGetReturnTypesWithoutCache() throws Exception { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); Invoker invoker = mock(Invoker.class); @@ -283,7 +283,7 @@ public class RpcUtilsTest { @Test - public void testGetReturnTypesWhenGeneric() throws Exception { + void testGetReturnTypesWhenGeneric() throws Exception { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); Invoker invoker = mock(Invoker.class); @@ -326,7 +326,7 @@ public class RpcUtilsTest { Assertions.assertNull(types5); } @Test - public void testGetParameterTypes() { + void testGetParameterTypes() { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); Invoker invoker = mock(Invoker.class); @@ -414,7 +414,7 @@ public class RpcUtilsTest { } @Test - public void testGet_$invoke_Arguments() { + void testGet_$invoke_Arguments() { Object[] args = new Object[] {"hello", "dubbo", 520}; Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); @@ -434,7 +434,7 @@ public class RpcUtilsTest { } @Test - public void testIsAsync() { + void testIsAsync() { Object[] args = new Object[] {"hello", "dubbo", 520}; Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); @@ -454,20 +454,20 @@ public class RpcUtilsTest { } @Test - public void testIsGenericCall() { + void testIsGenericCall() { Assertions.assertTrue(RpcUtils.isGenericCall("Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;", "$invoke")); Assertions.assertTrue(RpcUtils.isGenericCall("Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;", "$invokeAsync")); Assertions.assertFalse(RpcUtils.isGenericCall("Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;", "testMethod")); } @Test - public void testIsEcho() { + void testIsEcho() { Assertions.assertTrue(RpcUtils.isEcho("Ljava/lang/Object;", "$echo")); Assertions.assertFalse(RpcUtils.isEcho("Ljava/lang/Object;", "testMethod")); Assertions.assertFalse(RpcUtils.isEcho("Ljava/lang/String;", "$echo")); } @Test - public void testIsReturnTypeFuture() { + void testIsReturnTypeFuture() { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); Invoker invoker = mock(Invoker.class); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ArgumentCallbackTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ArgumentCallbackTest.java index 2505dafeb0..4442d7cf11 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ArgumentCallbackTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ArgumentCallbackTest.java @@ -42,7 +42,7 @@ import java.util.concurrent.locks.ReentrantLock; import static org.apache.dubbo.common.constants.CommonConstants.CALLBACK_INSTANCES_LIMIT_KEY; -public class ArgumentCallbackTest { +class ArgumentCallbackTest { protected Exporter exporter = null; protected Exporter hello_exporter = null; @@ -114,7 +114,7 @@ public class ArgumentCallbackTest { } @Test - public void TestCallbackNormalWithBindPort() throws Exception { + void TestCallbackNormalWithBindPort() throws Exception { initOrResetUrl(1, 10000000); consumerUrl = serviceURL.addParameter(Constants.BIND_PORT_KEY, "7653"); initOrResetService(); @@ -135,7 +135,7 @@ public class ArgumentCallbackTest { } @Test - public void TestCallbackNormal() throws Exception { + void TestCallbackNormal() throws Exception { initOrResetUrl(1, 10000000); initOrResetService(); @@ -157,7 +157,7 @@ public class ArgumentCallbackTest { } @Test - public void TestCallbackMultiInstans() throws Exception { + void TestCallbackMultiInstans() throws Exception { initOrResetUrl(2, 3000); initOrResetService(); IDemoCallback callback = new IDemoCallback() { @@ -206,7 +206,7 @@ public class ArgumentCallbackTest { } @Test - public void TestCallbackConsumerLimit() throws Exception { + void TestCallbackConsumerLimit() throws Exception { Assertions.assertThrows(RpcException.class, () -> { initOrResetUrl(1, 1000); // URL cannot be transferred automatically from the server side to the client side by using API, instead, @@ -233,7 +233,7 @@ public class ArgumentCallbackTest { } @Test - public void TestCallbackProviderLimit() throws Exception { + void TestCallbackProviderLimit() throws Exception { Assertions.assertThrows(RpcException.class, () -> { initOrResetUrl(1, 1000); // URL cannot be transferred automatically from the server side to the client side by using API, instead, @@ -275,7 +275,7 @@ public class ArgumentCallbackTest { @Disabled("need start with separate process") @Test - public void startProvider() throws Exception { + void startProvider() throws Exception { exportService(); synchronized (ArgumentCallbackTest.class) { ArgumentCallbackTest.class.wait(); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcInvocationTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcInvocationTest.java index d3b03167bb..25c75d2085 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcInvocationTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcInvocationTest.java @@ -23,7 +23,6 @@ import org.apache.dubbo.common.serialize.support.DefaultSerializationSelector; import org.apache.dubbo.common.url.component.ServiceConfigURL; import org.apache.dubbo.common.utils.CollectionUtils; import org.apache.dubbo.remoting.Channel; -import org.apache.dubbo.remoting.Constants; import org.apache.dubbo.remoting.buffer.ChannelBuffer; import org.apache.dubbo.remoting.buffer.ChannelBufferInputStream; import org.apache.dubbo.remoting.buffer.ChannelBufferOutputStream; @@ -49,10 +48,10 @@ import static org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.DUBBO_VERSION; /** * {@link DecodeableRpcInvocation} */ -public class DecodeableRpcInvocationTest { +class DecodeableRpcInvocationTest { @Test - public void test() throws Exception { + void test() throws Exception { // Simulate the data called by the client(The called data is stored in invocation and written to the buffer) URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 9103, DemoService.class.getName(), VERSION_KEY, "1.0.0"); RpcInvocation inv = new RpcInvocation(null, "sayHello", DemoService.class.getName(), "", new Class[]{String.class}, new String[]{"yug"}); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResultTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResultTest.java index 04dc51f7e1..89fa8c44db 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResultTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResultTest.java @@ -24,7 +24,6 @@ import org.apache.dubbo.common.serialize.support.DefaultSerializationSelector; import org.apache.dubbo.common.url.component.ServiceConfigURL; import org.apache.dubbo.common.utils.CollectionUtils; import org.apache.dubbo.remoting.Channel; -import org.apache.dubbo.remoting.Constants; import org.apache.dubbo.remoting.buffer.ChannelBuffer; import org.apache.dubbo.remoting.buffer.ChannelBufferInputStream; import org.apache.dubbo.remoting.buffer.ChannelBufferOutputStream; @@ -62,7 +61,7 @@ import static org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.RESPONSE_WITH_EXCEP /** * {@link DecodeableRpcResult} */ -public class DecodeableRpcResultTest { +class DecodeableRpcResultTest { private ModuleServiceRepository repository; @BeforeEach @@ -76,7 +75,7 @@ public class DecodeableRpcResultTest { } @Test - public void test() throws Exception { + void test() throws Exception { // Mock a rpcInvocation, this rpcInvocation is usually generated by the client request, and stored in Request#data Byte proto = CodecSupport.getIDByName(DefaultSerializationSelector.getDefaultRemotingSerialization()); URL url = new ServiceConfigURL("dubbo", "127.0.0.1", 9103, DemoService.class.getName(), VERSION_KEY, "1.0.0"); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCountCodecTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCountCodecTest.java index a0692275ed..50593274d5 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCountCodecTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCountCodecTest.java @@ -37,10 +37,10 @@ import java.util.Iterator; import static org.apache.dubbo.rpc.Constants.INPUT_KEY; import static org.apache.dubbo.rpc.Constants.OUTPUT_KEY; -public class DubboCountCodecTest { +class DubboCountCodecTest { @Test - public void test() throws Exception { + void test() throws Exception { DubboCountCodec dubboCountCodec = new DubboCountCodec(FrameworkModel.defaultModel()); ChannelBuffer buffer = ChannelBuffers.buffer(2048); Channel channel = new MockChannel(); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvokerAvailableTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvokerAvailableTest.java index e83fd1014d..3f01cbc2fb 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvokerAvailableTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvokerAvailableTest.java @@ -37,12 +37,11 @@ import org.junit.jupiter.api.Test; import java.lang.reflect.Field; import static org.apache.dubbo.common.constants.CommonConstants.SHUTDOWN_WAIT_KEY; -import static org.junit.jupiter.api.Assertions.fail; /** * Check available status for dubboInvoker */ -public class DubboInvokerAvailableTest { +class DubboInvokerAvailableTest { private static DubboProtocol protocol; private static ProxyFactory proxy = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); @@ -61,7 +60,7 @@ public class DubboInvokerAvailableTest { } @Test - public void test_Normal_available() { + void test_Normal_available() { int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + port + "/org.apache.dubbo.rpc.protocol.dubbo.IDemoService"); ProtocolUtils.export(new DemoServiceImpl(), IDemoService.class, url); @@ -73,7 +72,7 @@ public class DubboInvokerAvailableTest { } @Test - public void test_Normal_ChannelReadOnly() throws Exception { + void test_Normal_ChannelReadOnly() throws Exception { int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + port + "/org.apache.dubbo.rpc.protocol.dubbo.IDemoService"); ProtocolUtils.export(new DemoServiceImpl(), IDemoService.class, url); @@ -91,7 +90,7 @@ public class DubboInvokerAvailableTest { @Disabled @Test - public void test_normal_channel_close_wait_gracefully() throws Exception { + void test_normal_channel_close_wait_gracefully() throws Exception { int testPort = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + testPort + "/org.apache.dubbo.rpc.protocol.dubbo.IDemoService?scope=true&lazy=false"); Exporter exporter = ProtocolUtils.export(new DemoServiceImpl(), IDemoService.class, url); @@ -115,7 +114,7 @@ public class DubboInvokerAvailableTest { } @Test - public void test_NoInvokers() throws Exception { + void test_NoInvokers() throws Exception { int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + port + "/org.apache.dubbo.rpc.protocol.dubbo.IDemoService?connections=1"); ProtocolUtils.export(new DemoServiceImpl(), IDemoService.class, url); @@ -129,7 +128,7 @@ public class DubboInvokerAvailableTest { } @Test - public void test_Lazy_ChannelReadOnly() throws Exception { + void test_Lazy_ChannelReadOnly() throws Exception { int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + port + "/org.apache.dubbo.rpc.protocol.dubbo.IDemoService?lazy=true&connections=1&timeout=10000"); ProtocolUtils.export(new DemoServiceImpl(), IDemoService.class, url); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboLazyConnectTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboLazyConnectTest.java index eac5132cdb..6a0fed5d12 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboLazyConnectTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboLazyConnectTest.java @@ -33,7 +33,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.LAZY_CONNECT_KEY /** * dubbo protocol lazy connect test */ -public class DubboLazyConnectTest { +class DubboLazyConnectTest { @BeforeAll public static void setUpBeforeClass() { @@ -49,7 +49,7 @@ public class DubboLazyConnectTest { } @Test - public void testSticky1() { + void testSticky1() { Assertions.assertThrows(RpcException.class, () -> { int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + port + "/org.apache.dubbo.rpc.protocol.dubbo.IDemoService"); @@ -58,14 +58,14 @@ public class DubboLazyConnectTest { } @Test - public void testSticky2() { + void testSticky2() { int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + port + "/org.apache.dubbo.rpc.protocol.dubbo.IDemoService?" + LAZY_CONNECT_KEY + "=true"); ProtocolUtils.refer(IDemoService.class, url); } @Test - public void testSticky3() { + void testSticky3() { Assertions.assertThrows(IllegalStateException.class, () -> { int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + port + "/org.apache.dubbo.rpc.protocol.dubbo.IDemoService?" + LAZY_CONNECT_KEY + "=true"); @@ -75,7 +75,7 @@ public class DubboLazyConnectTest { } @Test - public void testSticky4() { + void testSticky4() { int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + port + "/org.apache.dubbo.rpc.protocol.dubbo.IDemoService?" + LAZY_CONNECT_KEY + "=true&timeout=20000"); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java index 8097285121..33c59fb502 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java @@ -58,7 +58,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * ProxiesTest */ -public class DubboProtocolTest { +class DubboProtocolTest { private Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); private ProxyFactory proxy = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); @@ -74,7 +74,7 @@ public class DubboProtocolTest { } @Test - public void testDemoProtocol() throws Exception { + void testDemoProtocol() throws Exception { DemoService service = new DemoServiceImpl(); int port = NetUtils.getAvailablePort(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:" + port + "/" + DemoService.class.getName() + "?codec=exchange"))); @@ -84,7 +84,7 @@ public class DubboProtocolTest { } @Test - public void testDubboProtocol() throws Exception { + void testDubboProtocol() throws Exception { DemoService service = new DemoServiceImpl(); int port = NetUtils.getAvailablePort(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:" + port + "/" + DemoService.class.getName()))); @@ -158,7 +158,7 @@ public class DubboProtocolTest { // } @Test - public void testDubboProtocolMultiService() throws Exception { + void testDubboProtocolMultiService() throws Exception { // DemoService service = new DemoServiceImpl(); // protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()))); // service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter("timeout", @@ -187,7 +187,7 @@ public class DubboProtocolTest { } @Test - public void testPerm() throws Exception { + void testPerm() throws Exception { DemoService service = new DemoServiceImpl(); int port = NetUtils.getAvailablePort(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:" + port + "/" + DemoService.class.getName() + "?codec=exchange"))); @@ -232,7 +232,7 @@ public class DubboProtocolTest { } @Test - public void testRemoteApplicationName() throws Exception { + void testRemoteApplicationName() throws Exception { DemoService service = new DemoServiceImpl(); int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + port + "/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", @@ -256,7 +256,7 @@ public class DubboProtocolTest { } @Test - public void testPayloadOverException() throws Exception { + void testPayloadOverException() throws Exception { DemoService service = new DemoServiceImpl(); int port = NetUtils.getAvailablePort(); protocol.export(proxy.getInvoker(service, DemoService.class, diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/FutureFilterTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/FutureFilterTest.java index d34f49a697..fc970cdc7d 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/FutureFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/FutureFilterTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock; * EventFilterTest.java * TODO rely on callback integration test for now */ -public class FutureFilterTest { +class FutureFilterTest { private static RpcInvocation invocation; private ClusterFilter eventFilter = new FutureFilter(); @@ -51,7 +51,7 @@ public class FutureFilterTest { } @Test - public void testSyncCallback() { + void testSyncCallback() { @SuppressWarnings("unchecked") Invoker invoker = mock(Invoker.class); given(invoker.isAvailable()).willReturn(true); @@ -67,7 +67,7 @@ public class FutureFilterTest { } @Test - public void testSyncCallbackHasException() throws RpcException, Throwable { + void testSyncCallbackHasException() throws RpcException, Throwable { Assertions.assertThrows(RuntimeException.class, () -> { @SuppressWarnings("unchecked") Invoker invoker = mock(Invoker.class); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/MultiThreadTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/MultiThreadTest.java index 59b63a69dd..a28f9c1d01 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/MultiThreadTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/MultiThreadTest.java @@ -36,7 +36,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -public class MultiThreadTest { +class MultiThreadTest { private Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); private ProxyFactory proxy = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); @@ -48,7 +48,7 @@ public class MultiThreadTest { } @Test - public void testDubboMultiThreadInvoke() throws Exception { + void testDubboMultiThreadInvoke() throws Exception { ApplicationModel.defaultModel().getDefaultModule().getServiceRepository().registerService("TestService", DemoService.class); int port = NetUtils.getAvailablePort(); Exporter rpcExporter = protocol.export(proxy.getInvoker(new DemoServiceImpl(), DemoService.class, URL.valueOf("dubbo://127.0.0.1:" + port + "/TestService"))); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ReferenceCountExchangeClientTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ReferenceCountExchangeClientTest.java index 864a5b61d0..f602aa6624 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ReferenceCountExchangeClientTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ReferenceCountExchangeClientTest.java @@ -45,7 +45,7 @@ import static org.apache.dubbo.remoting.Constants.CONNECTIONS_KEY; import static org.apache.dubbo.rpc.protocol.dubbo.Constants.LAZY_REQUEST_WITH_WARNING_KEY; import static org.apache.dubbo.rpc.protocol.dubbo.Constants.SHARE_CONNECTIONS_KEY; -public class ReferenceCountExchangeClientTest { +class ReferenceCountExchangeClientTest { public static ProxyFactory proxy = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); Exporter demoExporter; @@ -87,7 +87,7 @@ public class ReferenceCountExchangeClientTest { * test connection sharing */ @Test - public void test_share_connect() { + void test_share_connect() { init(0, 1); Assertions.assertEquals(demoClient.getLocalAddress(), helloClient.getLocalAddress()); Assertions.assertEquals(demoClient, helloClient); @@ -98,7 +98,7 @@ public class ReferenceCountExchangeClientTest { * test connection not sharing */ @Test - public void test_not_share_connect() { + void test_not_share_connect() { init(1, 1); Assertions.assertNotSame(demoClient.getLocalAddress(), helloClient.getLocalAddress()); Assertions.assertNotSame(demoClient, helloClient); @@ -109,7 +109,7 @@ public class ReferenceCountExchangeClientTest { * test using multiple shared connections */ @Test - public void test_multi_share_connect() { + void test_multi_share_connect() { // here a three shared connection is established between a consumer process and a provider process. final int shareConnectionNum = 3; @@ -134,7 +134,7 @@ public class ReferenceCountExchangeClientTest { * test counter won't count down incorrectly when invoker is destroyed for multiple times */ @Test - public void test_multi_destroy() { + void test_multi_destroy() { init(0, 1); DubboAppender.doStart(); DubboAppender.clear(); @@ -151,7 +151,7 @@ public class ReferenceCountExchangeClientTest { * Test against invocation still succeed even if counter has error */ @Test - public void test_counter_error() { + void test_counter_error() { init(0, 1); DubboAppender.doStart(); DubboAppender.clear(); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/RpcFilterTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/RpcFilterTest.java index 8737bc5c0a..13beb738bd 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/RpcFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/RpcFilterTest.java @@ -31,7 +31,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class RpcFilterTest { +class RpcFilterTest { private Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); private ProxyFactory proxy = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); @@ -41,7 +41,7 @@ public class RpcFilterTest { } @Test - public void testRpcFilter() throws Exception { + void testRpcFilter() throws Exception { DemoService service = new DemoServiceImpl(); int port = NetUtils.getAvailablePort(); URL url = URL.valueOf("dubbo://127.0.0.1:" + port + "/org.apache.dubbo.rpc.protocol.dubbo.support.DemoService?service.filter=echo"); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/decode/DubboTelnetDecodeTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/decode/DubboTelnetDecodeTest.java index 3e848a37d0..f6f08ab3ec 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/decode/DubboTelnetDecodeTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/decode/DubboTelnetDecodeTest.java @@ -58,7 +58,7 @@ import static org.apache.dubbo.rpc.Constants.SERIALIZATION_SECURITY_CHECK_KEY; /** * These junit tests aim to test unpack and stick pack of dubbo and telnet */ -public class DubboTelnetDecodeTest { +class DubboTelnetDecodeTest { private static AtomicInteger dubbo = new AtomicInteger(0); private static AtomicInteger telnet = new AtomicInteger(0); @@ -94,7 +94,7 @@ public class DubboTelnetDecodeTest { * @throws InterruptedException */ @Test - public void testDubboDecode() throws InterruptedException, IOException { + void testDubboDecode() throws InterruptedException, IOException { ByteBuf dubboByteBuf = createDubboByteBuf(); EmbeddedChannel ch = null; @@ -141,7 +141,7 @@ public class DubboTelnetDecodeTest { * @throws InterruptedException */ @Test - public void testTelnetDecode() throws InterruptedException { + void testTelnetDecode() throws InterruptedException { ByteBuf telnetByteBuf = Unpooled.wrappedBuffer("test\r\n".getBytes()); EmbeddedChannel ch = null; @@ -203,7 +203,7 @@ public class DubboTelnetDecodeTest { * @throws InterruptedException */ @Test - public void testTelnetDubboDecoded() throws InterruptedException, IOException { + void testTelnetDubboDecoded() throws InterruptedException, IOException { ByteBuf dubboByteBuf = createDubboByteBuf(); ByteBuf telnetByteBuf = Unpooled.wrappedBuffer("test\r".getBytes()); @@ -275,7 +275,7 @@ public class DubboTelnetDecodeTest { */ @Disabled @Test - public void testTelnetTelnetDecoded() throws InterruptedException { + void testTelnetTelnetDecoded() throws InterruptedException { ByteBuf firstByteBuf = Unpooled.wrappedBuffer("ls\r".getBytes()); ByteBuf secondByteBuf = Unpooled.wrappedBuffer("\nls\r\n".getBytes()); @@ -342,7 +342,7 @@ public class DubboTelnetDecodeTest { * @throws InterruptedException */ @Test - public void testDubboDubboDecoded() throws InterruptedException, IOException { + void testDubboDubboDecoded() throws InterruptedException, IOException { ByteBuf dubboByteBuf = createDubboByteBuf(); ByteBuf firstDubboByteBuf = dubboByteBuf.copy(0, 50); @@ -409,7 +409,7 @@ public class DubboTelnetDecodeTest { * @throws InterruptedException */ @Test - public void testDubboTelnetDecoded() throws InterruptedException, IOException { + void testDubboTelnetDecoded() throws InterruptedException, IOException { ByteBuf dubboByteBuf = createDubboByteBuf(); ByteBuf firstDubboByteBuf = dubboByteBuf.copy(0, 50); ByteBuf secondLeftDubboByteBuf = dubboByteBuf.copy(50, dubboByteBuf.readableBytes()); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/filter/TraceFilterTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/filter/TraceFilterTest.java index bef80f35b7..d58bf5ebaf 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/filter/TraceFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/filter/TraceFilterTest.java @@ -38,7 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -public class TraceFilterTest { +class TraceFilterTest { private MockChannel mockChannel; private static final String TRACE_MAX = "trace.max"; @@ -57,7 +57,7 @@ public class TraceFilterTest { } @Test - public void testAddAndRemoveTracer() throws Exception { + void testAddAndRemoveTracer() throws Exception { String method = "sayHello"; Class type = DemoService.class; String key = type.getName() + "." + method; @@ -85,7 +85,7 @@ public class TraceFilterTest { } @Test - public void testInvoke() throws Exception { + void testInvoke() throws Exception { String method = "sayHello"; Class type = DemoService.class; String key = type.getName() + "." + method; diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/status/ServerStatusCheckerTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/status/ServerStatusCheckerTest.java index c3fb10aa10..6061be5c79 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/status/ServerStatusCheckerTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/status/ServerStatusCheckerTest.java @@ -34,10 +34,10 @@ import java.util.List; /** * {@link ServerStatusChecker} */ -public class ServerStatusCheckerTest { +class ServerStatusCheckerTest { @Test - public void test() { + void test() { ServerStatusChecker serverStatusChecker = new ServerStatusChecker(); Status status = serverStatusChecker.check(); Assertions.assertEquals(status.getLevel(), Status.Level.UNKNOWN); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/status/ThreadPoolStatusCheckerTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/status/ThreadPoolStatusCheckerTest.java index 793de88280..246c3a9c48 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/status/ThreadPoolStatusCheckerTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/status/ThreadPoolStatusCheckerTest.java @@ -30,10 +30,10 @@ import java.util.concurrent.Executors; /** * {@link ThreadPoolStatusChecker} */ -public class ThreadPoolStatusCheckerTest { +class ThreadPoolStatusCheckerTest { @Test - public void test() { + void test() { DataStore dataStore = ExtensionLoader.getExtensionLoader(DataStore.class).getDefaultExtension(); ExecutorService executorService1 = Executors.newFixedThreadPool(1); ExecutorService executorService2 = Executors.newFixedThreadPool(10); diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/GrpcProtocolTest.java b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/GrpcProtocolTest.java index 1e63f66fc4..acf9859c45 100644 --- a/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/GrpcProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-grpc/src/test/java/org/apache/dubbo/rpc/protocol/grpc/GrpcProtocolTest.java @@ -44,12 +44,12 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -public class GrpcProtocolTest { +class GrpcProtocolTest { private Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); private ProxyFactory proxy = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); @Test - public void testDemoProtocol() throws Exception { + void testDemoProtocol() throws Exception { DubboGreeterGrpc.IGreeter serviceImpl = new GrpcGreeterImpl(); int availablePort = NetUtils.getAvailablePort(); diff --git a/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmClassLoaderTest.java b/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmClassLoaderTest.java index 765f689091..cd47462c1b 100644 --- a/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmClassLoaderTest.java +++ b/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmClassLoaderTest.java @@ -52,9 +52,9 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicReference; -public class InjvmClassLoaderTest { +class InjvmClassLoaderTest { @Test - public void testDifferentClassLoaderRequest() throws Exception { + void testDifferentClassLoaderRequest() throws Exception { String basePath = DemoService.class.getProtectionDomain().getCodeSource().getLocation().getFile(); basePath = java.net.URLDecoder.decode(basePath, "UTF-8"); TestClassLoader1 classLoader1 = new TestClassLoader1(basePath); diff --git a/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmDeepCopyTest.java b/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmDeepCopyTest.java index 80aea35a02..3acb7b254f 100644 --- a/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmDeepCopyTest.java +++ b/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmDeepCopyTest.java @@ -36,10 +36,10 @@ import org.junit.jupiter.api.Test; import java.io.Serializable; import java.util.concurrent.atomic.AtomicReference; -public class InjvmDeepCopyTest { +class InjvmDeepCopyTest { @Test - public void testDeepCopy() { + void testDeepCopy() { ApplicationModel applicationModel = new ApplicationModel(FrameworkModel.defaultModel()); applicationModel.getApplicationConfigManager().setApplication(new ApplicationConfig("TestInjvm")); diff --git a/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocolTest.java b/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocolTest.java index 4e57d054b4..8ad582a0ce 100644 --- a/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocolTest.java @@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * ProxiesTest */ -public class InjvmProtocolTest { +class InjvmProtocolTest { private final Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); @@ -66,7 +66,7 @@ public class InjvmProtocolTest { } @Test - public void testLocalProtocol() throws Exception { + void testLocalProtocol() throws Exception { DemoService service = new DemoServiceImpl(); Invoker invoker = proxy.getInvoker(service, DemoService.class, URL.valueOf("injvm://127.0.0.1/TestService").addParameter(INTERFACE_KEY, DemoService.class.getName())); assertTrue(invoker.isAvailable()); @@ -82,7 +82,7 @@ public class InjvmProtocolTest { } @Test - public void testLocalProtocolWithToken() throws Exception { + void testLocalProtocolWithToken() throws Exception { DemoService service = new DemoServiceImpl(); Invoker invoker = proxy.getInvoker(service, DemoService.class, URL.valueOf("injvm://127.0.0.1/TestService?token=abc").addParameter(INTERFACE_KEY, DemoService.class.getName())); assertTrue(invoker.isAvailable()); @@ -93,7 +93,7 @@ public class InjvmProtocolTest { } @Test - public void testIsInjvmRefer() throws Exception { + void testIsInjvmRefer() throws Exception { DemoService service = new DemoServiceImpl(); URL url = URL.valueOf("injvm://127.0.0.1/TestService") .addParameter(INTERFACE_KEY, DemoService.class.getName()); @@ -124,7 +124,7 @@ public class InjvmProtocolTest { } @Test - public void testLocalProtocolAsync() throws Exception { + void testLocalProtocolAsync() throws Exception { DemoService service = new DemoServiceImpl(); URL url = URL.valueOf("injvm://127.0.0.1/TestService") .addParameter(ASYNC_KEY, true) diff --git a/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/ProtocolTest.java b/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/ProtocolTest.java index 8a53d875bf..3713d6473e 100644 --- a/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/ProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-injvm/src/test/java/org/apache/dubbo/rpc/protocol/injvm/ProtocolTest.java @@ -29,7 +29,7 @@ import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -public class ProtocolTest { +class ProtocolTest { IEcho echo = new IEcho() { public String echo(String e) { @@ -48,7 +48,7 @@ public class ProtocolTest { Invoker invoker = proxyFactory.getInvoker(echo, IEcho.class, url); @Test - public void test_destroyWontCloseAllProtocol() throws Exception { + void test_destroyWontCloseAllProtocol() throws Exception { Protocol autowireProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); Protocol InjvmProtocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension("injvm"); diff --git a/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/RestProtocolTest.java b/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/RestProtocolTest.java index bdfa3f6470..758c7fb900 100644 --- a/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/RestProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/RestProtocolTest.java @@ -47,7 +47,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; -public class RestProtocolTest { +class RestProtocolTest { private Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension("rest"); private ProxyFactory proxy = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); private final int availablePort = NetUtils.getAvailablePort(); @@ -61,7 +61,7 @@ public class RestProtocolTest { } @Test - public void testRestProtocol() { + void testRestProtocol() { URL url = URL.valueOf("rest://127.0.0.1:" + NetUtils.getAvailablePort() + "/rest/say?version=1.0.0&interface=org.apache.dubbo.rpc.protocol.rest.DemoService"); DemoServiceImpl server = new DemoServiceImpl(); @@ -80,7 +80,7 @@ public class RestProtocolTest { } @Test - public void testRestProtocolWithContextPath() { + void testRestProtocolWithContextPath() { DemoServiceImpl server = new DemoServiceImpl(); Assertions.assertFalse(server.isCalled()); int port = NetUtils.getAvailablePort(); @@ -101,7 +101,7 @@ public class RestProtocolTest { } @Test - public void testExport() { + void testExport() { DemoService server = new DemoServiceImpl(); URL url = this.registerProvider(exportUrl, server, DemoService.class); @@ -118,7 +118,7 @@ public class RestProtocolTest { } @Test - public void testNettyServer() { + void testNettyServer() { DemoService server = new DemoServiceImpl(); URL url = this.registerProvider(exportUrl, server, DemoService.class); @@ -135,7 +135,7 @@ public class RestProtocolTest { } @Test - public void testServletWithoutWebConfig() { + void testServletWithoutWebConfig() { Assertions.assertThrows(RpcException.class, () -> { DemoService server = new DemoServiceImpl(); @@ -148,7 +148,7 @@ public class RestProtocolTest { } @Test - public void testErrorHandler() { + void testErrorHandler() { Assertions.assertThrows(RpcException.class, () -> { DemoService server = new DemoServiceImpl(); @@ -164,7 +164,7 @@ public class RestProtocolTest { } @Test - public void testInvoke() { + void testInvoke() { DemoService server = new DemoServiceImpl(); URL url = this.registerProvider(exportUrl, server, DemoService.class); @@ -178,7 +178,7 @@ public class RestProtocolTest { } @Test - public void testFilter() { + void testFilter() { DemoService server = new DemoServiceImpl(); URL url = this.registerProvider(exportUrl, server, DemoService.class); @@ -197,7 +197,7 @@ public class RestProtocolTest { } @Test - public void testRpcContextFilter() { + void testRpcContextFilter() { DemoService server = new DemoServiceImpl(); URL url = this.registerProvider(exportUrl, server, DemoService.class); @@ -230,7 +230,7 @@ public class RestProtocolTest { } @Test - public void testRegFail() { + void testRegFail() { Assertions.assertThrows(RuntimeException.class, () -> { DemoService server = new DemoServiceImpl(); @@ -242,7 +242,7 @@ public class RestProtocolTest { } @Test - public void testDefaultPort() { + void testDefaultPort() { assertThat(protocol.getDefaultPort(), is(80)); } diff --git a/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/RpcExceptionMapperTest.java b/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/RpcExceptionMapperTest.java index e29033e71b..5d4410ed7e 100644 --- a/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/RpcExceptionMapperTest.java +++ b/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/RpcExceptionMapperTest.java @@ -34,7 +34,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -public class RpcExceptionMapperTest { +class RpcExceptionMapperTest { private RpcExceptionMapper exceptionMapper; @@ -44,7 +44,7 @@ public class RpcExceptionMapperTest { } @Test - public void testConstraintViolationException() { + void testConstraintViolationException() { ConstraintViolationException violationException = mock(ConstraintViolationException.class); ConstraintViolation violation = mock(ConstraintViolation.class, Answers.RETURNS_DEEP_STUBS); given(violationException.getConstraintViolations()).willReturn(Sets.>newSet(violation)); @@ -57,7 +57,7 @@ public class RpcExceptionMapperTest { } @Test - public void testNormalException() { + void testNormalException() { RpcException rpcException = new RpcException(); Response response = exceptionMapper.toResponse(rpcException); diff --git a/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerApiListingResourceTest.java b/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerApiListingResourceTest.java index 565ddf75d5..5da404374a 100644 --- a/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerApiListingResourceTest.java +++ b/dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerApiListingResourceTest.java @@ -32,13 +32,13 @@ import java.util.Set; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class DubboSwaggerApiListingResourceTest { +class DubboSwaggerApiListingResourceTest { private Application app; private ServletConfig sc; @Test - public void test() throws Exception { + void test() throws Exception { DubboSwaggerApiListingResource resource = new DubboSwaggerApiListingResource(); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/TriRpcStatusTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/TriRpcStatusTest.java index 76a52efa5e..92bad1446d 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/TriRpcStatusTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/TriRpcStatusTest.java @@ -196,7 +196,7 @@ class TriRpcStatusTest { } @Test - public void fromMessage() { + void fromMessage() { String origin = "haha test 😊"; final String encoded = TriRpcStatus.encodeMessage(origin); Assertions.assertNotEquals(origin, encoded); @@ -205,7 +205,7 @@ class TriRpcStatusTest { } @Test - public void toMessage2() { + void toMessage2() { String content = "\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n"; final TriRpcStatus status = TriRpcStatus.INTERNAL .withDescription(content); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/DeadlineFutureTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/DeadlineFutureTest.java index ee0c5610e7..be5af72e37 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/DeadlineFutureTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/DeadlineFutureTest.java @@ -33,7 +33,7 @@ import static org.junit.jupiter.api.Assertions.fail; class DeadlineFutureTest { @Test - public void test() throws InterruptedException, ExecutionException { + void test() throws InterruptedException, ExecutionException { String service = "service"; String method = "method"; String address = "localhost:12201"; diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/Http2ProtocolDetectorTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/Http2ProtocolDetectorTest.java index e336db6226..4edb95549f 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/Http2ProtocolDetectorTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/Http2ProtocolDetectorTest.java @@ -16,11 +16,9 @@ */ package org.apache.dubbo.rpc.protocol.tri; -import org.apache.dubbo.remoting.Channel; import org.apache.dubbo.remoting.api.ProtocolDetector; import org.apache.dubbo.remoting.buffer.ByteBufferBackedChannelBuffer; import org.apache.dubbo.remoting.buffer.ChannelBuffer; -import org.apache.dubbo.remoting.buffer.ChannelBuffers; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; @@ -33,10 +31,10 @@ import org.mockito.Mockito; /** * {@link Http2ProtocolDetector} */ -public class Http2ProtocolDetectorTest { +class Http2ProtocolDetectorTest { @Test - public void testDetect() { + void testDetect() { ProtocolDetector detector = new Http2ProtocolDetector(); ChannelHandlerContext ctx = Mockito.mock(ChannelHandlerContext.class); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethodTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethodTest.java index ed050c2b90..c610e51b1f 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethodTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethodTest.java @@ -34,9 +34,9 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ReflectionPackableMethodTest { +class ReflectionPackableMethodTest { @Test - public void testMethodWithNoParameters() throws Exception { + void testMethodWithNoParameters() throws Exception { Method method = DescriptorService.class.getMethod("noParameterMethod"); MethodDescriptor descriptor = new ReflectionMethodDescriptor(method); assertEquals("", descriptor.getParamDesc()); @@ -44,7 +44,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testMethodWithNoParametersAndReturnProtobuf() throws Exception { + void testMethodWithNoParametersAndReturnProtobuf() throws Exception { Method method = DescriptorService.class.getMethod("noParameterAndReturnProtobufMethod"); MethodDescriptor descriptor = new ReflectionMethodDescriptor(method); assertEquals("", descriptor.getParamDesc()); @@ -53,7 +53,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testMethodWithNoParametersAndReturnJava() throws Exception { + void testMethodWithNoParametersAndReturnJava() throws Exception { Method method = DescriptorService.class.getMethod("noParameterAndReturnJavaClassMethod"); MethodDescriptor descriptor = new ReflectionMethodDescriptor(method); assertEquals("", descriptor.getParamDesc()); @@ -62,7 +62,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testWrapperBiStream() throws Exception { + void testWrapperBiStream() throws Exception { Method method = DescriptorService.class.getMethod("wrapBidirectionalStream", StreamObserver.class); ReflectionMethodDescriptor descriptor = new ReflectionMethodDescriptor(method); Assertions.assertEquals(1, descriptor.getParameterClasses().length); @@ -71,7 +71,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testBiStream() throws Exception { + void testBiStream() throws Exception { Method method = DescriptorService.class.getMethod("bidirectionalStream", StreamObserver.class); ReflectionMethodDescriptor descriptor = new ReflectionMethodDescriptor(method); Assertions.assertEquals(1, descriptor.getParameterClasses().length); @@ -80,7 +80,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testIsStream() throws NoSuchMethodException { + void testIsStream() throws NoSuchMethodException { Method method = DescriptorService.class.getMethod("noParameterMethod"); ReflectionMethodDescriptor md1 = new ReflectionMethodDescriptor(method); @@ -92,7 +92,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testIsUnary() throws NoSuchMethodException { + void testIsUnary() throws NoSuchMethodException { Method method = DescriptorService.class.getMethod("noParameterMethod"); MethodDescriptor descriptor = new ReflectionMethodDescriptor(method); Assertions.assertEquals(MethodDescriptor.RpcType.UNARY, descriptor.getRpcType()); @@ -103,7 +103,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testIsServerStream() throws NoSuchMethodException { + void testIsServerStream() throws NoSuchMethodException { Method method = DescriptorService.class.getMethod("sayHelloServerStream", HelloReply.class, StreamObserver.class); ReflectionMethodDescriptor descriptor = new ReflectionMethodDescriptor(method); @@ -115,7 +115,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testIsNeedWrap() throws NoSuchMethodException { + void testIsNeedWrap() throws NoSuchMethodException { Method method = DescriptorService.class.getMethod("noParameterMethod"); MethodDescriptor descriptor = new ReflectionMethodDescriptor(method); Assertions.assertTrue(needWrap(descriptor)); @@ -126,7 +126,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testIgnoreMethod() throws NoSuchMethodException { + void testIgnoreMethod() throws NoSuchMethodException { Method method = DescriptorService.class.getMethod("iteratorServerStream", HelloReply.class); MethodDescriptor descriptor = new ReflectionMethodDescriptor(method); Assertions.assertFalse(needWrap(descriptor)); @@ -147,7 +147,7 @@ public class ReflectionPackableMethodTest { @Test - public void testMultiProtoParameter() throws Exception { + void testMultiProtoParameter() throws Exception { Method method = DescriptorService.class.getMethod("testMultiProtobufParameters", HelloReply.class, HelloReply.class); assertThrows(IllegalStateException.class, () -> { @@ -157,7 +157,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testDiffParametersAndReturn() throws Exception { + void testDiffParametersAndReturn() throws Exception { Method method = DescriptorService.class.getMethod("testDiffParametersAndReturn", HelloReply.class); assertThrows(IllegalStateException.class, () -> { MethodDescriptor descriptor = new ReflectionMethodDescriptor(method); @@ -172,7 +172,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testErrorServerStream() throws Exception { + void testErrorServerStream() throws Exception { Method method = DescriptorService.class.getMethod("testErrorServerStream", StreamObserver.class, HelloReply.class); assertThrows(IllegalStateException.class, () -> { @@ -203,7 +203,7 @@ public class ReflectionPackableMethodTest { } @Test - public void testErrorBiStream() throws Exception { + void testErrorBiStream() throws Exception { Method method = DescriptorService.class.getMethod("testErrorBiStream", HelloReply.class, StreamObserver.class); assertThrows(IllegalStateException.class, () -> { MethodDescriptor descriptor = new ReflectionMethodDescriptor(method); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/SingleProtobufUtilsTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/SingleProtobufUtilsTest.java index ede3ee8183..d8fcd939c1 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/SingleProtobufUtilsTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/SingleProtobufUtilsTest.java @@ -42,10 +42,10 @@ import java.io.IOException; /** * {@link SingleProtobufUtils} */ -public class SingleProtobufUtilsTest { +class SingleProtobufUtilsTest { @Test - public void test() throws IOException { + void test() throws IOException { Assertions.assertFalse(SingleProtobufUtils.isSupported(SingleProtobufUtilsTest.class)); Assertions.assertTrue(SingleProtobufUtils.isSupported(Empty.class)); Assertions.assertTrue(SingleProtobufUtils.isSupported(BoolValue.class)); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TripleInvokerTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TripleInvokerTest.java index a0a9ac16f3..5b21e55c34 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TripleInvokerTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TripleInvokerTest.java @@ -44,7 +44,7 @@ import static org.mockito.Mockito.when; class TripleInvokerTest { @Test - public void testNewCall() throws NoSuchMethodException { + void testNewCall() throws NoSuchMethodException { URL url = URL.valueOf("tri://127.0.0.1:9103/" + IGreeter.class.getName()); Channel channel = Mockito.mock(Channel.class); AbstractConnectionClient connectionClient = Mockito.mock(AbstractConnectionClient.class); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TriplePathResolverTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TriplePathResolverTest.java index 8d245f77fe..fc223b1165 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TriplePathResolverTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TriplePathResolverTest.java @@ -30,7 +30,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class TriplePathResolverTest { +class TriplePathResolverTest { private static final PathResolver PATH_RESOLVER = ExtensionLoader.getExtensionLoader( PathResolver.class) @@ -75,19 +75,19 @@ public class TriplePathResolverTest { } @Test - public void testResolve() { + void testResolve() { Assertions.assertEquals(INVOKER, getInvokerByPath("/abc")); } @Test - public void testRemove() { + void testRemove() { Assertions.assertEquals(INVOKER, getInvokerByPath("/abc")); PATH_RESOLVER.remove("/abc"); Assertions.assertNull(getInvokerByPath("/abc")); } @Test - public void testNative() { + void testNative() { String path = "path"; Assertions.assertFalse(PATH_RESOLVER.hasNativeStub(path)); PATH_RESOLVER.addNativeStub(path); @@ -95,7 +95,7 @@ public class TriplePathResolverTest { } @Test - public void testDestroy() { + void testDestroy() { Assertions.assertEquals(INVOKER, getInvokerByPath("/abc")); { PATH_RESOLVER.add("/bcd", INVOKER); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocolTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocolTest.java index 3065ad0bde..483897d971 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocolTest.java @@ -43,10 +43,10 @@ import java.util.concurrent.TimeUnit; import static org.apache.dubbo.rpc.protocol.tri.support.IGreeter.SERVER_MSG; -public class TripleProtocolTest { +class TripleProtocolTest { @Test - public void testDemoProtocol() throws Exception { + void testDemoProtocol() throws Exception { IGreeter serviceImpl = new IGreeterImpl(); int availablePort = NetUtils.getAvailablePort(); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2Test.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2Test.java index 7525ea61a7..723c4b123c 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2Test.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2Test.java @@ -27,7 +27,7 @@ import org.junit.jupiter.params.provider.ValueSource; /** * test for Bzip2 */ -public class Bzip2Test { +class Bzip2Test { private static final String TEST_STR; diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/GzipTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/GzipTest.java index 152cfc789a..43bb0c701b 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/GzipTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/GzipTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -public class GzipTest { +class GzipTest { private static final String TEST_STR; diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/IdentityTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/IdentityTest.java index 91c6a8c43d..dc77255a0d 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/IdentityTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/IdentityTest.java @@ -40,4 +40,4 @@ class IdentityTest { final byte[] decompressed = Identity.IDENTITY.decompress(input); Assertions.assertEquals(input, decompressed); } -} \ No newline at end of file +} diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/SnappyTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/SnappyTest.java index 5a8b820510..7371f06c62 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/SnappyTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/compressor/SnappyTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.ValueSource; /** * test for snappy */ -public class SnappyTest { +class SnappyTest { private static final String TEST_STR; diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/frame/TriDecoderTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/frame/TriDecoderTest.java index db847d2b41..f0f2564b7b 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/frame/TriDecoderTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/frame/TriDecoderTest.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test; class TriDecoderTest { @Test - public void decode() { + void decode() { final RecordListener listener = new RecordListener(); TriDecoder decoder = new TriDecoder(DeCompressor.NONE, listener); final ByteBuf buf = Unpooled.buffer(); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/service/TriBuiltinServiceTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/service/TriBuiltinServiceTest.java index 42a82c844c..26181396ca 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/service/TriBuiltinServiceTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/service/TriBuiltinServiceTest.java @@ -28,10 +28,10 @@ import org.junit.jupiter.api.Test; /** * {@link TriBuiltinService} */ -public class TriBuiltinServiceTest { +class TriBuiltinServiceTest { @Test - public void test() { + void test() { FrameworkModel frameworkModel = new FrameworkModel(); TriBuiltinService triBuiltinService = new TriBuiltinService(frameworkModel); String serviceName = DubboHealthTriple.SERVICE_NAME; diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/service/TriHealthImplTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/service/TriHealthImplTest.java index 4e973e3e51..faa4b0ace3 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/service/TriHealthImplTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/service/TriHealthImplTest.java @@ -33,10 +33,10 @@ import java.util.IdentityHashMap; /** * {@link TriHealthImpl} */ -public class TriHealthImplTest { +class TriHealthImplTest { @Test - public void testCheck() { + void testCheck() { TriHealthImpl triHealth = new TriHealthImpl(); HealthCheckRequest request = HealthCheckRequest.newBuilder().build(); @@ -48,7 +48,7 @@ public class TriHealthImplTest { } @Test - public void testWatch() throws Exception { + void testWatch() throws Exception { TriHealthImpl triHealth = new TriHealthImpl(); HealthCheckRequest request = HealthCheckRequest.newBuilder() diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleClientStreamTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleClientStreamTest.java index c89f6c3998..9542f28f4b 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleClientStreamTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleClientStreamTest.java @@ -58,7 +58,7 @@ import static org.mockito.Mockito.when; class TripleClientStreamTest { @Test - public void progress() { + void progress() { final URL url = URL.valueOf("tri://127.0.0.1:8080/foo.bar.service"); final ModuleServiceRepository repo = ApplicationModel.defaultModel().getDefaultModule() .getServiceRepository(); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleHttp2ClientResponseHandlerTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleHttp2ClientResponseHandlerTest.java index b00c8363e5..466066383c 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleHttp2ClientResponseHandlerTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleHttp2ClientResponseHandlerTest.java @@ -35,7 +35,7 @@ import org.mockito.Mockito; /** * {@link TripleHttp2ClientResponseHandler } */ -public class TripleHttp2ClientResponseHandlerTest { +class TripleHttp2ClientResponseHandlerTest { private TripleHttp2ClientResponseHandler handler; private ChannelHandlerContext ctx; private AbstractH2TransportListener transportListener; @@ -51,7 +51,7 @@ public class TripleHttp2ClientResponseHandlerTest { } @Test - public void testUserEventTriggered() throws Exception { + void testUserEventTriggered() throws Exception { // test Http2GoAwayFrame Http2GoAwayFrame goAwayFrame = new DefaultHttp2GoAwayFrame(Http2Error.NO_ERROR, ByteBufUtil .writeAscii(ByteBufAllocator.DEFAULT, "app_requested")); @@ -65,7 +65,7 @@ public class TripleHttp2ClientResponseHandlerTest { } @Test - public void testChannelRead0() throws Exception { + void testChannelRead0() throws Exception { final Http2Headers headers = new DefaultHttp2Headers(true); DefaultHttp2HeadersFrame headersFrame = new DefaultHttp2HeadersFrame(headers, true); handler.channelRead0(ctx, headersFrame); @@ -73,7 +73,7 @@ public class TripleHttp2ClientResponseHandlerTest { } @Test - public void testExceptionCaught() { + void testExceptionCaught() { RuntimeException exception = new RuntimeException(); handler.exceptionCaught(ctx, exception); Mockito.verify(ctx).close(); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/WriteQueueTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/WriteQueueTest.java index bd7b19f5bb..4912f3f438 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/WriteQueueTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/WriteQueueTest.java @@ -46,7 +46,7 @@ import static org.apache.dubbo.rpc.protocol.tri.transport.WriteQueue.DEQUE_CHUNK /** * {@link WriteQueue} */ -public class WriteQueueTest { +class WriteQueueTest { private final AtomicInteger writeMethodCalledTimes = new AtomicInteger(0); private Channel channel; @@ -72,7 +72,7 @@ public class WriteQueueTest { } @Test - public void test() throws Exception { + void test() throws Exception { WriteQueue writeQueue = new WriteQueue(); writeQueue.enqueue(HeaderQueueCommand.createHeaders(new DefaultHttp2Headers()).channel(channel)); @@ -99,7 +99,7 @@ public class WriteQueueTest { } @Test - public void testChunk() throws Exception { + void testChunk() throws Exception { WriteQueue writeQueue = new WriteQueue(); // test deque chunk size writeMethodCalledTimes.set(0); diff --git a/dubbo-spring-boot/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java b/dubbo-spring-boot/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java index 2268b9d3f3..e90122fbe8 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java +++ b/dubbo-spring-boot/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/autoconfigure/DubboEndpointAnnotationAutoConfigurationTest.java @@ -83,7 +83,7 @@ import java.util.function.Supplier; }) @EnableAutoConfiguration @Disabled -public class DubboEndpointAnnotationAutoConfigurationTest { +class DubboEndpointAnnotationAutoConfigurationTest { @Autowired private DubboMetadataEndpoint dubboEndpoint; @@ -122,7 +122,7 @@ public class DubboEndpointAnnotationAutoConfigurationTest { } @Test - public void testShutdown() throws Exception { + void testShutdown() throws Exception { Map value = dubboShutdownEndpoint.shutdown(); @@ -136,7 +136,7 @@ public class DubboEndpointAnnotationAutoConfigurationTest { } @Test - public void testConfigs() { + void testConfigs() { Map>> configsMap = dubboConfigsMetadataEndpoint.configs(); @@ -173,7 +173,7 @@ public class DubboEndpointAnnotationAutoConfigurationTest { } @Test - public void testServices() { + void testServices() { Map> services = dubboServicesMetadataEndpoint.services(); @@ -186,7 +186,7 @@ public class DubboEndpointAnnotationAutoConfigurationTest { } @Test - public void testReferences() { + void testReferences() { Map> references = dubboReferencesMetadataEndpoint.references(); @@ -200,7 +200,7 @@ public class DubboEndpointAnnotationAutoConfigurationTest { } @Test - public void testProperties() { + void testProperties() { SortedMap properties = dubboPropertiesEndpoint.properties(); @@ -219,7 +219,7 @@ public class DubboEndpointAnnotationAutoConfigurationTest { } @Test - public void testHttpEndpoints() throws JsonProcessingException { + void testHttpEndpoints() throws JsonProcessingException { // testHttpEndpoint("/dubbo", dubboEndpoint::invoke); testHttpEndpoint("/dubbo/configs", dubboConfigsMetadataEndpoint::configs); testHttpEndpoint("/dubbo/services", dubboServicesMetadataEndpoint::services); @@ -261,4 +261,4 @@ public class DubboEndpointAnnotationAutoConfigurationTest { private DemoService demoService; } -} +} \ No newline at end of file diff --git a/dubbo-spring-boot/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/endpoint/DubboEndpointTest.java b/dubbo-spring-boot/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/endpoint/DubboEndpointTest.java index 6fd8e3681f..87dfb6333b 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/endpoint/DubboEndpointTest.java +++ b/dubbo-spring-boot/dubbo-spring-boot-actuator/src/test/java/org/apache/dubbo/spring/boot/actuate/endpoint/DubboEndpointTest.java @@ -49,7 +49,7 @@ import static org.apache.dubbo.common.Version.getVersion; } ) @EnableAutoConfiguration -public class DubboEndpointTest { +class DubboEndpointTest { @Autowired @@ -66,7 +66,7 @@ public class DubboEndpointTest { } @Test - public void testInvoke() { + void testInvoke() { Map metadata = dubboEndpoint.invoke(); @@ -90,4 +90,4 @@ public class DubboEndpointTest { } -} +} \ No newline at end of file diff --git a/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/BinderDubboConfigBinderTest.java b/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/BinderDubboConfigBinderTest.java index b992610af0..807a0c4906 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/BinderDubboConfigBinderTest.java +++ b/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/BinderDubboConfigBinderTest.java @@ -42,7 +42,7 @@ import static com.alibaba.spring.util.PropertySourcesUtils.getSubProperties; @RunWith(SpringRunner.class) @TestPropertySource(locations = "classpath:/dubbo.properties") @ContextConfiguration(classes = BinderDubboConfigBinder.class) -public class BinderDubboConfigBinderTest { +class BinderDubboConfigBinderTest { @Autowired private ConfigurationBeanBinder dubboConfigBinder; @@ -51,7 +51,7 @@ public class BinderDubboConfigBinderTest { private ConfigurableEnvironment environment; @Test - public void testBinder() { + void testBinder() { ApplicationConfig applicationConfig = new ApplicationConfig(); Map properties = getSubProperties(environment.getPropertySources(), "dubbo.application"); @@ -69,4 +69,4 @@ public class BinderDubboConfigBinderTest { dubboConfigBinder.bind(properties, true, true, protocolConfig); Assert.assertEquals(Integer.valueOf(20881), protocolConfig.getPort()); } -} +} \ No newline at end of file diff --git a/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfigurationTest.java b/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfigurationTest.java index 9aa10529fe..df418da731 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfigurationTest.java +++ b/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfigurationTest.java @@ -52,7 +52,7 @@ import static org.junit.Assert.assertTrue; }) @EnableAutoConfiguration @PropertySource(value = "classpath:/dubbo.properties") -public class DubboRelaxedBinding2AutoConfigurationTest { +class DubboRelaxedBinding2AutoConfigurationTest { @Autowired @Qualifier(BASE_PACKAGES_BEAN_NAME) @@ -75,7 +75,7 @@ public class DubboRelaxedBinding2AutoConfigurationTest { private ApplicationContext applicationContext; @Test - public void testBeans() { + void testBeans() { assertTrue(ClassUtils.isAssignableValue(BinderDubboConfigBinder.class, dubboConfigBinder)); @@ -95,4 +95,4 @@ public class DubboRelaxedBinding2AutoConfigurationTest { assertTrue(environments.containsValue(environment)); } -} +} \ No newline at end of file diff --git a/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/env/DubboDefaultPropertiesEnvironmentPostProcessorTest.java b/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/env/DubboDefaultPropertiesEnvironmentPostProcessorTest.java index bde4c383a7..3adb6f17e3 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/env/DubboDefaultPropertiesEnvironmentPostProcessorTest.java +++ b/dubbo-spring-boot/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/env/DubboDefaultPropertiesEnvironmentPostProcessorTest.java @@ -30,7 +30,7 @@ import java.util.HashMap; /** * {@link DubboDefaultPropertiesEnvironmentPostProcessor} Test */ -public class DubboDefaultPropertiesEnvironmentPostProcessorTest { +class DubboDefaultPropertiesEnvironmentPostProcessorTest { private DubboDefaultPropertiesEnvironmentPostProcessor instance = new DubboDefaultPropertiesEnvironmentPostProcessor(); @@ -38,12 +38,12 @@ public class DubboDefaultPropertiesEnvironmentPostProcessorTest { private SpringApplication springApplication = new SpringApplication(); @Test - public void testOrder() { + void testOrder() { Assert.assertEquals(Ordered.LOWEST_PRECEDENCE, instance.getOrder()); } @Test - public void testPostProcessEnvironment() { + void testPostProcessEnvironment() { MockEnvironment environment = new MockEnvironment(); // Case 1 : Not Any property instance.postProcessEnvironment(environment, springApplication); @@ -94,4 +94,4 @@ public class DubboDefaultPropertiesEnvironmentPostProcessorTest { Assert.assertEquals("false", environment.getProperty("dubbo.config.multiple")); Assert.assertEquals("false", environment.getProperty("dubbo.application.qos-enable")); } -} +} \ No newline at end of file diff --git a/dubbo-xds/src/test/java/org/apache/dubbo/registry/xds/util/bootstrap/BootstrapperTest.java b/dubbo-xds/src/test/java/org/apache/dubbo/registry/xds/util/bootstrap/BootstrapperTest.java index 180e260ca5..cae21deb37 100644 --- a/dubbo-xds/src/test/java/org/apache/dubbo/registry/xds/util/bootstrap/BootstrapperTest.java +++ b/dubbo-xds/src/test/java/org/apache/dubbo/registry/xds/util/bootstrap/BootstrapperTest.java @@ -16,19 +16,20 @@ */ package org.apache.dubbo.registry.xds.util.bootstrap; -import io.grpc.netty.shaded.io.netty.channel.unix.DomainSocketAddress; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.url.component.URLAddress; import org.apache.dubbo.registry.xds.XdsInitializationException; + +import io.grpc.netty.shaded.io.netty.channel.unix.DomainSocketAddress; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.List; -public class BootstrapperTest { +class BootstrapperTest { @Test - public void testParse() throws XdsInitializationException { + void testParse() throws XdsInitializationException { String rawData = "{\n" + " \"xds_servers\": [\n" + " {\n" + @@ -133,7 +134,7 @@ public class BootstrapperTest { } @Test - public void testUrl() { + void testUrl() { URL url = URL.valueOf("dubbo://127.0.0.1:23456/TestService?useAgent=true"); Assertions.assertTrue(url.getParameter("useAgent", false)); }