@@ -96,7 +96,7 @@ void record(Runnable mocker, Object[] args, Object result, Predicate<Object> pre
96
96
return null ;
97
97
});
98
98
Method testWithArexMock = getMethod (result );
99
- DynamicClassExtractor extractor = new DynamicClassExtractor (testWithArexMock , args );
99
+ DynamicClassExtractor extractor = new DynamicClassExtractor (testWithArexMock , args , null );
100
100
extractor .recordResponse (result );
101
101
102
102
assertTrue (predicate .test (result ));
@@ -125,7 +125,7 @@ void resetMonoResponse() {
125
125
Method testWithArexMock = DynamicClassExtractorTest .class .getDeclaredMethod ("testWithArexMock" ,
126
126
String .class );
127
127
final Object [] args = {"errorSerialize" };
128
- final DynamicClassExtractor extractor = new DynamicClassExtractor (testWithArexMock , args );
128
+ final DynamicClassExtractor extractor = new DynamicClassExtractor (testWithArexMock , args , null );
129
129
final Predicate <Object > nonNull = Objects ::nonNull ;
130
130
131
131
// exception
@@ -427,10 +427,10 @@ void invalidOperation() throws Throwable {
427
427
final Object [] args = {"errorSerialize" };
428
428
ConfigBuilder .create ("invalid-operation" ).enableDebug (true ).build ();
429
429
Mockito .when (Serializer .serializeWithException (any (), anyString ())).thenThrow (new RuntimeException ("errorSerialize" ));
430
- DynamicClassExtractor extractor = new DynamicClassExtractor (testWithArexMock , args );
430
+ DynamicClassExtractor extractor = new DynamicClassExtractor (testWithArexMock , args , null );
431
431
extractor .recordResponse ("errorSerialize" );
432
432
// invalid operation return empty
433
- DynamicClassExtractor extractor2 = new DynamicClassExtractor (testWithArexMock , args );
433
+ DynamicClassExtractor extractor2 = new DynamicClassExtractor (testWithArexMock , args , null );
434
434
final Field methodKey = DynamicClassExtractor .class .getDeclaredField ("methodKey" );
435
435
methodKey .setAccessible (true );
436
436
assertNull (methodKey .get (extractor2 ));
@@ -442,14 +442,14 @@ void invalidOperation() throws Throwable {
442
442
443
443
// test getSerializedResult serialize
444
444
Mockito .when (agentSizeOf .checkMemorySizeLimit (any (), any (long .class ))).thenReturn (true );
445
- extractor = new DynamicClassExtractor (testWithArexMock , args );
445
+ extractor = new DynamicClassExtractor (testWithArexMock , args , null );
446
446
assertNull (extractor .getSerializedResult ());
447
447
}
448
448
449
449
@ Test
450
450
void emptyMethodKeyAndExceedSize () throws NoSuchMethodException {
451
451
Method testEmptyArgs = DynamicClassExtractorTest .class .getDeclaredMethod ("invalidOperation" );
452
- DynamicClassExtractor extractor = new DynamicClassExtractor (testEmptyArgs , new Object [0 ]);
452
+ DynamicClassExtractor extractor = new DynamicClassExtractor (testEmptyArgs , new Object [0 ], null );
453
453
assertDoesNotThrow (() -> extractor .recordResponse (new int [1001 ]));
454
454
}
455
455
@@ -566,12 +566,31 @@ void testProceedingJointPoint() throws Throwable {
566
566
Mockito .when (joinPoint .getSignature ()).thenReturn (signature );
567
567
String arg1 = "arg1" ;
568
568
Mockito .when (joinPoint .getArgs ()).thenReturn (new Object []{arg1 });
569
- DynamicClassExtractor extractor = new DynamicClassExtractor (testProceedingJointPoint , new Object []{joinPoint });
569
+ DynamicClassExtractor extractor = new DynamicClassExtractor (testProceedingJointPoint , new Object []{joinPoint }, null );
570
570
Field requestType = DynamicClassExtractor .class .getDeclaredField ("requestType" );
571
571
requestType .setAccessible (true );
572
572
assertEquals ("[\" java.lang.String\" ]" , requestType .get (extractor ));
573
573
}
574
574
575
575
public void testProceedingJointPoint (ProceedingJoinPoint joinPoint ) {
576
576
}
577
+
578
+ @ Test
579
+ void testRecordWithAbstractClassMethod () throws Exception {
580
+ CacheClass cacheClass = new CacheClass ();
581
+ Method abstractMethod = AbstractClass .class .getDeclaredMethod ("abstractMethod" , String .class );
582
+ Field clazzName = DynamicClassExtractor .class .getDeclaredField ("clazzName" );
583
+ clazzName .setAccessible (true );
584
+ DynamicClassExtractor extractor = new DynamicClassExtractor (abstractMethod , new Object []{"arg" }, cacheClass );
585
+ assertEquals (CacheClass .class .getName (), clazzName .get (extractor ));
586
+ }
587
+
588
+ static abstract class AbstractClass {
589
+ public String abstractMethod (String arg ) {
590
+ return arg ;
591
+ }
592
+ }
593
+
594
+ static class CacheClass extends AbstractClass {
595
+ }
577
596
}
0 commit comments