必要な依存先ライブラリがすべて利用できるよう、ビルド システムの設定を手動で変更できます。

Maven で依存先ライブラリを追加する

pom.xml ファイルを編集し、<dependencies> セクションにエンティティを追加します。次のエントリには必要なすべてのライブラリが含まれています。

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
    <scope>test</scope>
</dependency>
<dependency>
	<groupId>org.mockito</groupId>
	<artifactId>mockito-all</artifactId>
	<version>1.10.19</version>
	<scope>test</scope>
</dependency>
<dependency>
    <groupId>org.powermock</groupId>
    <artifactId>powermock-module-junit4</artifactId>
    <version>1.6.5</version>
    <scope>test</scope>
</dependency>
<dependency>
	<groupId>org.powermock</groupId>
	<artifactId>powermock-core</artifactId>
	<version>1.6.5</version>
	<scope>test</scope>
</dependency>
<dependency>
	<groupId>org.powermock</groupId>
	<artifactId>powermock-api-mockito</artifactId>
	<version>1.6.5</version>
	<scope>test</scope>
</dependency>
<dependency>
	<groupId>org.powermock</groupId>
	<artifactId>powermock-api-support</artifactId>
	<version>1.6.5</version>
	<scope>test</scope>
</dependency>
<dependency>
	<groupId>pl.pragmatists</groupId>
	<artifactId>JUnitParams</artifactId>
	<version>1.0.6</version>
	<scope>test</scope>
</dependency>

Gradle で依存先ライブラリを追加する

build.gradle ファイルを編集し、dependencies セクションにエンティティを追加します。次のエントリには必要なすべてのライブラリが含まれています。

testCompile 'org.powermock:powermock-module-junit4:1.6.5'
testCompile 'org.powermock:powermock-api-mockito:1.6.5'
testCompile 'junit:junit:4.11'
testCompile 'pl.pragmatists:JUnitParams:1.0.6'

Ant で依存先ライブラリを追加する

Ant の場合、必要なすべての JAR ファイルを個別のディレクトリに追加する必要があります。build.xml ファイルに手動でディレクトリを追加します。

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

以下のライブラリが必要です。

  • junit-4.11
  • JUnitParams-1.0.6
  • mockito-all-1.10.19
  • powermock-mockito-1.6.5-full

ライブラリはオンラインまたは [INSTALL_DIR]/examples/demo/lib にあります。

  • No labels