简体   繁体   English

如何将PowerMock添加到项目中?

[英]How do you add PowerMock to your project?

I am using mockito in my project and then found i could not use mockito for static classes and so have been told to download and use powermock. 我在项目中使用了模仿,然后发现我无法对静态类使用模仿,因此被告知要下载并使用powermock。 i download from here https://code.google.com/p/powermock/wiki/Downloads , this file specifically. 我从这里https://code.google.com/p/powermock/wiki/Downloads专门下载此文件。 PowerMock 1.6.0 with Mockito and JUnit including dependencies 具有Mockito和JUnit的PowerMock 1.6.0(包括依赖项)

Do i just need to import the JARs from this into my project library? 我是否只需要从中将JAR导入到我的项目库中? or is there more to it? 还是还有更多?

I assume you don't use maven. 我认为您不使用Maven。 You just have to add the corresponding powermock version. 您只需要添加相应的powermock版本。 Take a look to this mapping and choose the right version: 查看此映射并选择正确的版本:

Mockito             PowerMock
1.10+               1.6.0
1.9.5-rc1 - 1.9.5   1.5.0 - 1.5.6
1.9.0-rc1 & 1.9.0   1.4.10 - 1.4.12
1.8.5               1.3.9 - 1.4.9
1.8.4               1.3.7 & 1.3.8
1.8.3               1.3.6
1.8.1 & 1.8.2       1.3.5
1.8                 1.3
1.7                 1.2.5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Eclipse中的Android项目中使用Java项目? - How do you use a Java project in your Android project in Eclipse? 如何在客户端升级/更新web java项目? - How do you upgrade / update web java project at your clients? 您如何决定何时升级项目中的库? - How do you decide when to upgrade a library in your project? 如何在Netbeans的主类中添加jFrame? - How do you add a jFrame to your main class in Netbeans? 你如何在eclipse中向svn添加项目? - How do you add a project to svn in eclipse? 如何在没有IDE的情况下在项目中添加/引用.jar文件 - How to add/reference .jar files in your project when you don't have an IDE 如何在 React Native run-android 中解决“您的项目中需要有 MainApplication” - How do I resolve 'You need to have MainApplication in your project' in React native run-android 如何命令IntelliJ在反映您的项目结构的“ Tests”目录中创建相应的JUnit测试? - How do you command IntelliJ to create corresponding JUnit tests in a “Tests” directory that mirrors your project structure? 您如何/在何处搜索计算机/项目中已安装的Java库? - How / where do you search for installed java libraries on your computer / project? 如何在Eclipse中将图像添加到项目目录? - how do you add images to the project directory in eclipse?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM