|
|
|
@ -5,6 +5,7 @@ import com.fr.third.net.bytebuddy.agent.ByteBuddyAgent;
|
|
|
|
|
import com.fr.third.net.bytebuddy.asm.Advice; |
|
|
|
|
import com.fr.third.net.bytebuddy.dynamic.loading.ClassReloadingStrategy; |
|
|
|
|
import com.fr.third.net.bytebuddy.matcher.ElementMatchers; |
|
|
|
|
import org.junit.Assert; |
|
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -31,7 +32,7 @@ public class BytebuddyRedefineTest {
|
|
|
|
|
TestClass testClass = new TestClass(); |
|
|
|
|
testClass.testPrint(); |
|
|
|
|
} catch (Throwable throwable) { |
|
|
|
|
|
|
|
|
|
Assert.assertNotNull("expected throw exception", throwable); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -52,9 +53,9 @@ public class BytebuddyRedefineTest {
|
|
|
|
|
TestClass testClass = new TestClass(); |
|
|
|
|
String print = testClass.testPrint(); |
|
|
|
|
|
|
|
|
|
System.out.println(TestTransferValueAdvice.intField); |
|
|
|
|
System.out.println(TestTransferValueAdvice.stringField); |
|
|
|
|
System.out.println(TestTransferValueAdvice.objectField); |
|
|
|
|
Assert.assertEquals(10, TestTransferValueAdvice.intField); |
|
|
|
|
Assert.assertEquals("[test]stringField", TestTransferValueAdvice.stringField); |
|
|
|
|
Assert.assertEquals("[test]objectField", TestTransferValueAdvice.objectField); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -75,7 +76,8 @@ public class BytebuddyRedefineTest {
|
|
|
|
|
TestClass testClass = new TestClass(); |
|
|
|
|
String print = testClass.testPrint(); |
|
|
|
|
|
|
|
|
|
System.out.println(print); |
|
|
|
|
Assert.assertEquals("[test]Modify Return Value", print); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |