Tuesday, December 19, 2017

Mockito Error

If you get this error, "No instance field named " reporter" could be found in the class hierarchy of org.mockito.internal.MockitoCore." you may be missing the mockito in your POM.xml dependencies, check it.  It will look like below (mockito and powermock):

<dependency>
  <groupId>org.mockito</groupId>
  <artifactId>mockito-core</artifactId>
  <version>1.10.19</version>
</dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <version>1.7.0</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.mockito</groupId>
                    <artifactId>mockito-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>1.7.0</version>
            <scope>test</scope>
        </dependency>

No comments:

Post a Comment