java.lang.IllegalArgumentException: Cannot subclass final class class org.song.example.AFinalClass

Google Groups | abu0khalique | 7 months ago
  1. 0

    Error mocking final class with static method with JUnit 4.x and Mockito.

    Google Groups | 7 months ago | abu0khalique
    java.lang.IllegalArgumentException: Cannot subclass final class class org.song.example.AFinalClass
  2. 0

    Robolectric + PowerMock + Mockito not working

    Stack Overflow | 9 months ago | JavierSP1209
    java.lang.IllegalArgumentException: Cannot subclass final class class roboguice.RoboGuice at org.mockito.cglib.proxy.Enhancer.generateClass(Enhancer.java:447)
  3. 0

    How can I mock an instance of an enum class with PowerMock & Mockito?

    Stack Overflow | 2 years ago
    java.lang.IllegalArgumentException: Cannot subclass final class class com.myproject.test.support.ExampleEnumerable
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java - How can I mock an instance of an enum class with PowerMock & Mockito? - Stack Overflow

    xluat.com | 1 year ago
    java.lang.IllegalArgumentException: Cannot subclass final class class com.myproject.test.support.ExampleEnumerable
  6. 0

    Run-time exception when running simple unit test with Powermock (with mockito) on Android Studio

    Stack Overflow | 10 months ago | OliverOstach
    java.lang.RuntimeException: Invoking the beforeTestMethod method on PowerMock test listener org.powermock.api.extension.listener.AnnotationEnabler@38d8f54a failed.

    14 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Cannot subclass final class class org.song.example.AFinalClass

      at org.mockito.cglib.proxy.Enhancer.generateClass()
    2. Mockito
      Enhancer.createClass
      1. org.mockito.cglib.proxy.Enhancer.generateClass(Enhancer.java:447)
      2. org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
      3. org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:217)
      4. org.mockito.cglib.proxy.Enhancer.createHelper(Enhancer.java:378)
      5. org.mockito.cglib.proxy.Enhancer.createClass(Enhancer.java:318)
      5 frames
    3. org.powermock.api
      ClassImposterizer.imposterise
      1. org.powermock.api.mockito.repackaged.ClassImposterizer.createProxyClass(ClassImposterizer.java:124)
      2. org.powermock.api.mockito.repackaged.ClassImposterizer.imposterise(ClassImposterizer.java:58)
      2 frames
    4. powermock-api-mockito
      PowerMockito.mockStatic
      1. org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocationControl(MockCreator.java:122)
      2. org.powermock.api.mockito.internal.mockcreation.MockCreator.createMock(MockCreator.java:70)
      3. org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:47)
      4. org.powermock.api.mockito.PowerMockito.mockStatic(PowerMockito.java:71)
      4 frames
    5. org.song.example
      AFinalClassTest.mockFinalClassTest
      1. org.song.example.AFinalClassTest.mockFinalClassTest(AFinalClassTest.java:30)
      1 frame
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    7. JUnit
      InvokeMethod.evaluate
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:46)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:43)
      4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      4 frames
    8. Mockito
      JUnitRule$1.evaluate
      1. org.mockito.internal.junit.JUnitRule$1.evaluate(JUnitRule.java:16)
      1 frame
    9. Powermock
      PowerMockStatement.evaluate
      1. org.powermock.modules.junit4.rule.PowerMockStatement.evaluate(PowerMockRule.java:75)
      1 frame
    10. JUnit
      JUnitCore.run
      1. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:270)
      2. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      3. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
      4. org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      5. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:62)
      6. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      7. org.junit.runners.ParentRunner.access$000(ParentRunner.java:52)
      8. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      9. org.junit.runners.ParentRunner.run(ParentRunner.java:307)
      10. org.junit.runner.JUnitCore.run(JUnitCore.java:152)
      10 frames
    11. IntelliJ junit4 module
      JUnit4IdeaTestRunner.startRunnerWithArgs
      1. com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
      1 frame
    12. IDEA
      JUnitStarter.main
      1. com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
      2. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
      2 frames
    13. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:498)
      4 frames
    14. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
      1 frame