简体   繁体   English

在没有注释的情况下在Java中模拟静态方法

[英]Mocking static methods in Java without annotations

Are there any libraries for the JVM that allow mocking of static methods WITHOUT needing annotations? 是否有任何JVM库允许模拟静态方法而不需要注释? I am attempting to build this feature into a Clojure testing framework (Midje). 我正在尝试将此功能构建到Clojure测试框架(Midje)中。 Clojure has very poor, or non-existant annotation support. Clojure具有非常差或不存在的注释支持。

Use powermock .It's a great library for mocking. 使用powermock。这是一个很棒的模拟库。 And here is an example that explains how to mock static methods. 是一个解释如何模拟静态方法的示例。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM