Skip to content

Commit 7e51047

Browse files
authored
delete never thrown exception (#11674)
1 parent e74c638 commit 7e51047

File tree

81 files changed

+364
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+364
-365
lines changed

dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/filter/DefaultFilterChainBuilderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void testBuildInvokerChainForLocalReference() {
4343
urlWithoutFilter = urlWithoutFilter.setScopeModel(ApplicationModel.defaultModel());
4444
AbstractInvoker<DemoService> invokerWithoutFilter = new AbstractInvoker<DemoService>(DemoService.class, urlWithoutFilter) {
4545
@Override
46-
protected Result doInvoke(Invocation invocation) throws Throwable {
46+
protected Result doInvoke(Invocation invocation) {
4747
return null;
4848
}
4949
};
@@ -58,7 +58,7 @@ protected Result doInvoke(Invocation invocation) throws Throwable {
5858
urlWithFilter = urlWithFilter.setScopeModel(ApplicationModel.defaultModel());
5959
AbstractInvoker<DemoService> invokerWithFilter = new AbstractInvoker<DemoService>(DemoService.class, urlWithFilter) {
6060
@Override
61-
protected Result doInvoke(Invocation invocation) throws Throwable {
61+
protected Result doInvoke(Invocation invocation) {
6262
return null;
6363
}
6464
};
@@ -93,7 +93,7 @@ protected Result doInvoke(Invocation invocation) throws Throwable {
9393
urlWithFilter = urlWithFilter.setScopeModel(ApplicationModel.defaultModel());
9494
AbstractInvoker<DemoService> invokerWithFilter = new AbstractInvoker<DemoService>(DemoService.class, urlWithFilter) {
9595
@Override
96-
protected Result doInvoke(Invocation invocation) throws Throwable {
96+
protected Result doInvoke(Invocation invocation) {
9797
return null;
9898
}
9999
};

dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ protected Result doInvoke(Invocation invocation, List invokers, LoadBalance load
194194
}
195195

196196
@Test
197-
void testSelect_Invokersize0() throws Exception {
197+
void testSelect_Invokersize0() {
198198
LoadBalance l = cluster.initLoadBalance(invokers, invocation);
199199
Assertions.assertNotNull(l,"cluster.initLoadBalance returns null!");
200200
{
@@ -228,7 +228,7 @@ protected Result doInvoke(Invocation invocation, List invokers, LoadBalance load
228228
}
229229

230230
@Test
231-
void testSelect_Invokersize1() throws Exception {
231+
void testSelect_Invokersize1() {
232232
invokers.clear();
233233
invokers.add(invoker1);
234234
LoadBalance l = cluster.initLoadBalance(invokers, invocation);
@@ -238,7 +238,7 @@ void testSelect_Invokersize1() throws Exception {
238238
}
239239

240240
@Test
241-
void testSelect_Invokersize2AndselectNotNull() throws Exception {
241+
void testSelect_Invokersize2AndselectNotNull() {
242242
invokers.clear();
243243
invokers.add(invoker2);
244244
invokers.add(invoker4);
@@ -412,7 +412,7 @@ void testSelectAgainAndCheckAvailable() {
412412
}
413413

414414

415-
public void testSelect_multiInvokers(String lbname) throws Exception {
415+
public void testSelect_multiInvokers(String lbname) {
416416

417417
int min = 100, max = 500;
418418
Double d = (Math.random() * (max - min + 1) + min);

dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ClusterUtilsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void setup() {
5555
}
5656

5757
@Test
58-
void testMergeUrl() throws Exception {
58+
void testMergeUrl() {
5959
URL providerURL = URL.valueOf("dubbo://localhost:55555");
6060
providerURL = providerURL.setPath("path")
6161
.setUsername("username")

dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/merger/DefaultProviderURLMergeProcessorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void setup() {
5757
}
5858

5959
@Test
60-
void testMergeUrl() throws Exception {
60+
void testMergeUrl() {
6161
URL providerURL = URL.valueOf("dubbo://localhost:55555");
6262
providerURL = providerURL.setPath("path")
6363
.setUsername("username")

dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/MixinTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class MixinTest {
2424

2525
@Test
26-
void testMain() throws Exception {
26+
void testMain() {
2727
Mixin mixin = Mixin.mixin(new Class[]{I1.class, I2.class, I3.class}, new Class[]{C1.class, C2.class});
2828
Object o = mixin.newInstance(new Object[]{new C1(), new C2()});
2929
assertTrue(o instanceof I1);
@@ -69,4 +69,4 @@ public void setMixinInstance(Object mi) {
6969
System.out.println("setMixinInstance:" + mi);
7070
}
7171
}
72-
}
72+
}

dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavassistCompilerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void testCompileJavaClass0() throws Exception {
5555
}
5656

5757
@Test
58-
void testCompileJavaClass1() throws Exception {
58+
void testCompileJavaClass1() {
5959
Assertions.assertThrows(IllegalStateException.class, () -> {
6060
JavassistCompiler compiler = new JavassistCompiler();
6161
Class<?> clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithSyntax0(), JavassistCompiler.class.getClassLoader());
@@ -82,4 +82,4 @@ void testCompileJavaClassWithExtends() throws Exception {
8282
Method sayHello = instance.getClass().getMethod("sayHello");
8383
Assertions.assertEquals("Hello world3!", sayHello.invoke(instance));
8484
}
85-
}
85+
}

dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JdkCompilerTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void test_compileJavaClass() throws Exception {
3333
}
3434

3535
@Test
36-
void test_compileJavaClass0() throws Exception {
36+
void test_compileJavaClass0() {
3737
Assertions.assertThrows(IllegalStateException.class, () -> {
3838
JdkCompiler compiler = new JdkCompiler();
3939
Class<?> clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithoutPackage(), JdkCompiler.class.getClassLoader());
@@ -44,7 +44,7 @@ void test_compileJavaClass0() throws Exception {
4444
}
4545

4646
@Test
47-
void test_compileJavaClass1() throws Exception {
47+
void test_compileJavaClass1() {
4848
Assertions.assertThrows(IllegalStateException.class, () -> {
4949
JdkCompiler compiler = new JdkCompiler();
5050
Class<?> clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithSyntax(), JdkCompiler.class.getClassLoader());
@@ -64,7 +64,7 @@ void test_compileJavaClass_java8() throws Exception {
6464
}
6565

6666
@Test
67-
void test_compileJavaClass0_java8() throws Exception {
67+
void test_compileJavaClass0_java8() {
6868
Assertions.assertThrows(IllegalStateException.class, () -> {
6969
JdkCompiler compiler = new JdkCompiler("1.8");
7070
Class<?> clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithoutPackage(), JdkCompiler.class.getClassLoader());
@@ -75,7 +75,7 @@ void test_compileJavaClass0_java8() throws Exception {
7575
}
7676

7777
@Test
78-
void test_compileJavaClass1_java8() throws Exception {
78+
void test_compileJavaClass1_java8() {
7979
Assertions.assertThrows(IllegalStateException.class, () -> {
8080
JdkCompiler compiler = new JdkCompiler("1.8");
8181
Class<?> clazz = compiler.compile(JavaCodeTest.class, getSimpleCodeWithSyntax(), JdkCompiler.class.getClassLoader());
@@ -84,4 +84,4 @@ void test_compileJavaClass1_java8() throws Exception {
8484
Assertions.assertEquals("Hello world!", sayHello.invoke(instance));
8585
});
8686
}
87-
}
87+
}

dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/AbstractDynamicConfigurationTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ class AbstractDynamicConfigurationTest {
5252
public void init() {
5353
configuration = new AbstractDynamicConfiguration(null) {
5454
@Override
55-
protected String doGetConfig(String key, String group) throws Exception {
55+
protected String doGetConfig(String key, String group) {
5656
return null;
5757
}
5858

5959
@Override
60-
protected void doClose() throws Exception {
60+
protected void doClose() {
6161

6262
}
6363

6464
@Override
65-
protected boolean doRemoveConfig(String key, String group) throws Exception {
65+
protected boolean doRemoveConfig(String key, String group) {
6666
return false;
6767
}
6868
};
@@ -93,17 +93,17 @@ void testConstructor() {
9393
AbstractDynamicConfiguration configuration = new AbstractDynamicConfiguration(url) {
9494

9595
@Override
96-
protected String doGetConfig(String key, String group) throws Exception {
96+
protected String doGetConfig(String key, String group) {
9797
return null;
9898
}
9999

100100
@Override
101-
protected void doClose() throws Exception {
101+
protected void doClose() {
102102

103103
}
104104

105105
@Override
106-
protected boolean doRemoveConfig(String key, String group) throws Exception {
106+
protected boolean doRemoveConfig(String key, String group) {
107107
return false;
108108
}
109109
};
@@ -202,4 +202,4 @@ void testRemoveConfigAndDoRemoveConfig() throws Exception {
202202
assertEquals(configuration.removeConfig(key, group), configuration.doRemoveConfig(key, group));
203203
assertFalse(configuration.removeConfig(key, group));
204204
}
205-
}
205+
}

dubbo-common/src/test/java/org/apache/dubbo/common/io/BytesTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class BytesTest {
3232
private byte[] bytes2 = {3, 12, 14, 41, 12, 2, 3, 12, 4, 67};
3333

3434
@Test
35-
void testMain() throws Exception {
35+
void testMain() {
3636
short s = (short) 0xabcd;
3737
assertThat(s, is(Bytes.bytes2short(Bytes.short2bytes(s))));
3838

@@ -86,7 +86,7 @@ void testSmallLength() {
8686
}
8787

8888
@Test
89-
void testBase64S2b2sFailCaseLog() throws Exception {
89+
void testBase64S2b2sFailCaseLog() {
9090
String s1 = Bytes.bytes2base64(bytes1);
9191
byte[] out1 = Bytes.base642bytes(s1);
9292
assertThat(bytes1, is(out1));
@@ -161,4 +161,4 @@ private byte[] long2bytes(long x) {
161161
bb[7] = (byte) (x >> 0);
162162
return bb;
163163
}
164-
}
164+
}

dubbo-common/src/test/java/org/apache/dubbo/common/resource/GlobalResourcesRepositoryTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class GlobalResourcesRepositoryTest {
2828

2929
@Test
30-
void test() throws NoSuchFieldException {
30+
void test() {
3131
GlobalResourcesRepository repository = GlobalResourcesRepository.getInstance();
3232

3333
ExecutorService globalExecutorService = GlobalResourcesRepository.getGlobalExecutorService();
@@ -74,4 +74,4 @@ public boolean isDestroyed() {
7474
return destroyed;
7575
}
7676
}
77-
}
77+
}

0 commit comments

Comments
 (0)