org.powermock.api.mockito.ClassNotPreparedException: The class org.springframework.web.util.WebUtils not prepared for test. To prepare this class, add class to the '@PrepareForTest' annotation. In case if you don't use this annotation, add the annotation on class or method level.

tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    mockito: The class [X] not prepared for test

    Stack Overflow | 6 months ago | Amadeu Cabanilles
    org.powermock.api.mockito.ClassNotPreparedException: The class org.springframework.web.util.WebUtils not prepared for test. To prepare this class, add class to the '@PrepareForTest' annotation. In case if you don't use this annotation, add the annotation on class or method level.
  2. 0

    PowerMock + Robolectric + ActiveAndroid

    Stack Overflow | 10 months ago | user5483163
    org.powermock.api.mockito.ClassNotPreparedException: The class com.activeandroid.content.ContentProvider not prepared for test. To prepare this class, add class to the '@PrepareForTest' annotation. In case if you don't use this annotation, add the annotation on class or method level.
  3. 0

    android - PowerMock + Robolectric - Stack Overflow на русском

    stackoverflow.com | 8 months ago
    org.powermock.api.mockito.ClassNotPreparedException: The class com.activeandroid.content.ContentProvider not prepared for test. To prepare this class, add class to the '@PrepareForTest' annotation. In case if you don't use this annotation, add the annotation on class or method level.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to combine PowerMock and Robolectric

    Stack Overflow | 1 month ago | Zeyad Gasser
    org.powermock.api.mockito.ClassNotPreparedException: The class com.zeyad.usecases.data.utils.Utils not prepared for test. To prepare this class, add class to the '@PrepareForTest' annotation. In case if you don't use this annotation, add the annotation on class or method level.

    1 unregistered visitors

    Root Cause Analysis

    1. org.powermock.api.mockito.ClassNotPreparedException

      The class org.springframework.web.util.WebUtils not prepared for test. To prepare this class, add class to the '@PrepareForTest' annotation. In case if you don't use this annotation, add the annotation on class or method level.

      at org.powermock.api.mockito.expectation.reporter.MockitoPowerMockReporter.classNotPrepared()
    2. org.powermock.api
      MockitoPowerMockReporter.classNotPrepared
      1. org.powermock.api.mockito.expectation.reporter.MockitoPowerMockReporter.classNotPrepared(MockitoPowerMockReporter.java:31)
      1 frame
    3. powermock-api-mockito
      PowerMockito.mockStatic
      1. org.powermock.api.mockito.internal.mockcreation.MockTypeValidatorFactory$DefaultMockTypeValidator.validate(MockTypeValidatorFactory.java:38)
      2. org.powermock.api.mockito.internal.mockcreation.AbstractMockCreator.validateType(AbstractMockCreator.java:18)
      3. org.powermock.api.mockito.internal.mockcreation.MockCreator.createMock(MockCreator.java:57)
      4. org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:47)
      5. org.powermock.api.mockito.PowerMockito.mockStatic(PowerMockito.java:71)
      5 frames
    4. com.tdk.iot
      ProductCriteriaPeriodControllerTest.setUpTest
      1. com.tdk.iot.controller.criteria.ProductCriteriaPeriodControllerTest.setUpTest(ProductCriteriaPeriodControllerTest.java:83)
      1 frame
    5. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:606)
      4 frames
    6. JUnit
      ParentRunner.run
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      4. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
      5. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
      6. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
      7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
      8. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
      9. org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
      10. org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
      11. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      12. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
      13. org.junit.runners.ParentRunner.run(ParentRunner.java:220)
      13 frames
    7. Mockito
      MockitoJUnitRunner.run
      1. org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)
      2. org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)
      2 frames
    8. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
      1 frame
    9. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      5 frames