You can manually modify your build system to ensure that all the required dependencies are available.

Adding Dependencies in Maven

Modify the pom.xml file by updating the <dependencyManagement>, <dependencies>, and <repositories> sections. The following entries include all the required libraries:

<dependencyManagement>
      <dependencies>
          <dependency>
              <groupId>org.mockito</groupId>
              <artifactId>mockito-core</artifactId>
              <version>2.23.0</version>
          </dependency>
          <dependency>
              <groupId>net.bytebuddy</groupId>
              <artifactId>byte-buddy</artifactId>
              <version>1.9.3</version>
          </dependency>
          <dependency>
              <groupId>net.bytebuddy</groupId>
              <artifactId>byte-buddy-agent</artifactId>
              <version>1.9.3</version>
          </dependency>
      </dependencies>
</dependencyManagement>

      <dependencies>
          <dependency>
              <groupId>junit</groupId>
              <artifactId>junit</artifactId>
              <version>4.12</version>
              <scope>test</scope>
          </dependency>
          <dependency>
              <groupId>pl.pragmatists</groupId>
              <artifactId>JUnitParams</artifactId>
              <version>1.1.1</version>
              <scope>test</scope>
          </dependency>
          <dependency>
              <groupId>org.powermock</groupId>
              <artifactId>powermock-module-junit4</artifactId>
              <version>2.0.2</version>
              <scope>test</scope>
          </dependency>
          <dependency>
              <groupId>org.powermock</groupId>
              <artifactId>powermock-api-mockito2</artifactId>
              <version>2.0.2</version>
              <scope>test</scope>
          </dependency>
      </dependencies>

      <repositories>
          <repository>
              <id>mockito</id>
              <name>mockito</name>
              <url>https://dl.bintray.com/mockito/maven/</url>
          </repository>
          <repository>
              <id>powermock</id>
              <name>powermock</name>
              <url>https://dl.bintray.com/powermock/maven/</url>
          </repository>
      </repositories>

Adding Dependencies in Gradle

Modify the build.gradle file by updating the following sections. The following entries include all the required libraries:

repositories {
    maven {
        url  "https://dl.bintray.com/mockito/maven/"
    }
    maven {
        url "https://dl.bintray.com/powermock/maven/"
    }
}

dependencies {
    testCompile 'junit:junit:4.12'
    testCompile 'pl.pragmatists:JUnitParams:1.1.1'
    testCompile 'org.mockito:mockito-core:2.23.0'
    testCompile 'org.powermock:powermock-module-junit4:2.0.2'
    testCompile 'org.powermock:powermock-api-mockito2:2.0.2'
}

Adding Dependencies in Ant

Ant requires all required JAR files to be added to a separate directory. The directory must be added manually by including in the build.xml file:

<classpath>
    <!-- filesets can be used in classpath and bootpath -->
	<fileset dir="C:/directory_name/lib">
				<include name="**/*.jar"/>
    </fileset>
</classpath>

The following libraries are required:

  • junit-4.12.jar
  • JUnitParams-1.1.1.jar
  • hamcrest-core-1.3.jar
  • javassist-3.24.0-GA.jar
  • byte-buddy-1.9.3.jar
  • byte-buddy-agent-1.9.3.jar
  • objenesis-2.6.jar
  • mockito-core-2.23.0.jar
  • powermock-mockito2-2.0.2-full.jar

The libraries are available online or in the [INSTALL_DIR]/examples/demo/lib.

  • No labels