我正在尝试模拟私有方法。所以我正在使用powermock。 我正在使用@PrepareForTest注释。在运行测试用例时获取以下错误。 如果我将删除上面的注释,我没有得到这样的错误。 任何人都可以帮助我。我过去两天都在挣扎。
java.lang.VerifyError: StackMapTable error: bad offset
Exception Details:
Location:
edu/apollogrp/common/HandyTestBase.<clinit>()V @0: iconst_0
Reason:
Invalid stackmap specification.
Current Frame:
bci: @188
flags: { }
locals: { 'java/lang/StringBuilder', 'java/lang/String' }
stack: { }
Bytecode:
0000000: 03b3 042b 014b 0e48 014e 2a01 a500 082a
0000010: 4ea7 000a 1304 2db8 042f 4e2d 1304 3103
0000020: bd00 0813 0433 b804 3513 0437 b804 393a
0000030: 0419 04b2 043b a600 0ab8 043f 48a7 000c
0000040: 1904 c000 3cb6 0442 4827 1404 436b 8eb3
0000050: 0446 0000 0000 014b 014c 1304 47b8 0449
0000060: 03bd 0008 1304 4ab8 044c b804 4e4d 2cb2
0000070: 0450 a500 2f2c c101 4f99 0020 b804 5213
0000080: 0453 b804 5512 0801 b604 57b6 0459 01b6
0000090: 045b c001 824c a700 082c c001 824c a700
00000a0: 0bbb 0182 59b7 045d 4c2b 1304 5f4c 4b01
00000b0: 4d01 4e2a 01a5 0008 2a4e a700 0a13 0460
00000c0: b804 624e 2d13 0463 04bd 0008 5903 2b53
00000d0: 1304 64b8 0466 1304 67b8 0469 3a04 1904
00000e0: b204 6ba6 000c 2a2b b604 6d4d a700 0919
00000f0: 04c0 0182 4d2c b804 6f4c 4b01 4d01 4e2a
0000100: 01a5 0008 2a4e a700 0a13 0470 b804 724e
0000110: 2d13 0473 04bd 0008 5903 2b53 1304 74b8
0000120: 0476 1304 77b8 0479 3a04 1904 b204 7ba6
0000130: 000c 2a2b b604 7d4d a700 0919 04c0 0182
0000140: 4d2c 4b01 4c01 4d2a 01a5 0008 2a4d a700
0000150: 0a13 047e b804 804d 2c13 0481 03bd 0008
0000160: 1304 82b8 0484 1304 85b8 0487 4e2d b204
0000170: 89a6 000b 2ab6 048b 4ca7 0008 2dc0 0082
0000180: 4c2b b304 8db1
Stackmap Table:
same_frame(@20)
full_frame(@27,{Top,Top,Top,Object[#157]},{})
full_frame(@64,{Top,Top,Top,Top,Object[#8]},{})
full_frame(@73,{Top,Double},{})
full_frame(@153,{Top,Top,Object[#8]},{})
full_frame(@158,{Top,Object[#386]},{})
chop_frame(@161,2)
append_frame(@169,Top,Object[#386])
full_frame(@188,{Object[#386],Object[#130]},{})
append_frame(@195,Top,Object[#8])
full_frame(@238,{Top,Top,Top,Top,Object[#8]},{})
full_frame(@244,{Top,Top,Object[#386]},{})
full_frame(@264,{Object[#386],Object[#130]},{})
append_frame(@271,Top,Object[#8])
full_frame(@314,{Top,Top,Top,Top,Object[#8]},{})
full_frame(@320,{Top,Top,Object[#386]},{})
full_frame(@336,{Object[#386]},{})
append_frame(@343,Top,Object[#8])
full_frame(@379,{Top,Top,Top,Object[#8]},{})
full_frame(@384,{Top,Object[#130]},{})
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetPublicMethods(Unknown Source)
at java.lang.Class.getMethods(Unknown Source)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.getTestMethods(PowerMockJUnit44RunnerDelegateImpl.java:93)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.<init>(PowerMockJUnit44RunnerDelegateImpl.java:69)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl.<init>(PowerMockJUnit47RunnerDelegateImpl.java:42)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:149)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:39)
at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:217)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:59)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:32)
at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:33)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestMethodReference.<init>(JUnit4TestMethodReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:54)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)