Skip to content

Commit 8ae462b

Browse files
committed
fix test error
1 parent 4eebf1b commit 8ae462b

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

test/test-extension/src/test/java/org/dromara/dynamictp/agent/AgentAwareTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
package org.dromara.dynamictp.agent;
1919

20+
import org.dromara.dynamictp.common.util.ReflectionUtil;
2021
import org.dromara.dynamictp.core.support.ThreadPoolBuilder;
21-
import org.dromara.dynamictp.extension.agent.AgentAware;
2222
import org.dromara.dynamictp.core.support.task.runnable.DtpRunnable;
23+
import org.dromara.dynamictp.extension.agent.AgentAware;
2324
import org.junit.Assert;
2425
import org.junit.Test;
2526
import org.junit.jupiter.api.Assertions;
26-
import org.springframework.util.ReflectionUtils;
2727

2828
import java.lang.reflect.InvocationTargetException;
2929
import java.lang.reflect.Method;
@@ -36,7 +36,7 @@ public class AgentAwareTest {
3636

3737
@Test
3838
public void testDirectOnlyOneDtpRunnable() throws InvocationTargetException, IllegalAccessException {
39-
Method getDtpRunnableInstance = ReflectionUtils.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
39+
Method getDtpRunnableInstance = ReflectionUtil.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
4040
Assertions.assertNotNull(getDtpRunnableInstance);
4141

4242
getDtpRunnableInstance.setAccessible(true);
@@ -45,7 +45,6 @@ public void testDirectOnlyOneDtpRunnable() throws InvocationTargetException, Ill
4545

4646
};
4747

48-
4948
MyAgentWrapper myAgentWrapper = new MyAgentWrapper(runnable, new Object());
5049
Object result = getDtpRunnableInstance.invoke(new AgentAware(), myAgentWrapper);
5150
Assertions.assertTrue(result == myAgentWrapper);
@@ -64,7 +63,7 @@ public void testDirectTwoRunnable() throws InvocationTargetException, IllegalAcc
6463
DtpRunnable dtpRunnable = new DtpRunnable(runnable, runnable, "test");
6564
MyAgentWrapperTwoRunnable myAgentWrapper = new MyAgentWrapperTwoRunnable(dtpRunnable, runnable, "test");
6665

67-
Method getDtpRunnableInstance = ReflectionUtils.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
66+
Method getDtpRunnableInstance = ReflectionUtil.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
6867
Assertions.assertNotNull(getDtpRunnableInstance);
6968
getDtpRunnableInstance.setAccessible(true);
7069

@@ -85,7 +84,7 @@ public void testNotDirectRunnable() throws InvocationTargetException, IllegalAcc
8584
MyAgentWrapper myAgentWrapper = new MyAgentWrapper(dtpRunnable, new Object());
8685

8786
MyAgentTwoPathRunnableWrapper twoPathRunnableWrapper = new MyAgentTwoPathRunnableWrapper(myAgentWrapper, new Object());
88-
Method getDtpRunnableInstance = ReflectionUtils.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
87+
Method getDtpRunnableInstance = ReflectionUtil.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
8988
Assertions.assertNotNull(getDtpRunnableInstance);
9089
getDtpRunnableInstance.setAccessible(true);
9190

@@ -102,7 +101,7 @@ public void testExtendRunnable() throws InvocationTargetException, IllegalAccess
102101
MyAgentWrapper myAgentWrapper = new MyAgentWrapper(dtpRunnable, new Object());
103102
MyAgentWrapperChild myAgentWrapperChild = new MyAgentWrapperChild(myAgentWrapper, new Object());
104103

105-
Method getDtpRunnableInstance = ReflectionUtils.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
104+
Method getDtpRunnableInstance = ReflectionUtil.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
106105
Assertions.assertNotNull(getDtpRunnableInstance);
107106
getDtpRunnableInstance.setAccessible(true);
108107

@@ -123,7 +122,7 @@ public void testDeepRunnable() throws InvocationTargetException, IllegalAccessEx
123122
MyAgentTwoPathRunnableChildWrapper myAgentTwoPathRunnableChildWrapper = new MyAgentTwoPathRunnableChildWrapper(myAgentWrapperChild,
124123
myAgentWrapper, new Object());
125124

126-
Method getDtpRunnableInstance = ReflectionUtils.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
125+
Method getDtpRunnableInstance = ReflectionUtil.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
127126
Assertions.assertNotNull(getDtpRunnableInstance);
128127
getDtpRunnableInstance.setAccessible(true);
129128
Object result = getDtpRunnableInstance.invoke(new AgentAware(), myAgentTwoPathRunnableChildWrapper);
@@ -137,7 +136,7 @@ public void testNestRunnable() throws InvocationTargetException, IllegalAccessEx
137136
Runnable runnable = () -> System.out.println("test");
138137
DtpRunnable dtpRunnable = new DtpRunnable(runnable, runnable, "test");
139138
MyAgentNestWrapper myAgentNestWrapper = new MyAgentNestWrapper(dtpRunnable);
140-
Method getDtpRunnableInstance = ReflectionUtils.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
139+
Method getDtpRunnableInstance = ReflectionUtil.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
141140
getDtpRunnableInstance.setAccessible(true);
142141
Object result = getDtpRunnableInstance.invoke(new AgentAware(), myAgentNestWrapper);
143142
Assertions.assertTrue(dtpRunnable == dtpRunnable);
@@ -152,7 +151,7 @@ public void testContainNestRunnable() throws InvocationTargetException, IllegalA
152151

153152
MyAgentContainNestWrapper myAgentContainNestWrapper = new MyAgentContainNestWrapper(myAgentNestWrapper);
154153

155-
Method getDtpRunnableInstance = ReflectionUtils.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
154+
Method getDtpRunnableInstance = ReflectionUtil.findMethod(AgentAware.class, "getDtpRunnableInstance", Runnable.class);
156155
getDtpRunnableInstance.setAccessible(true);
157156
Object result = getDtpRunnableInstance.invoke(new AgentAware(), myAgentContainNestWrapper);
158157
Assertions.assertTrue(dtpRunnable == dtpRunnable);

0 commit comments

Comments
 (0)