PowerMock &爪哇 11 [英] PowerMock & Java 11

查看:152
本文介绍了PowerMock &爪哇 11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在一些历史项目中使用了 PowerMock.不幸的是,PowerMock 已经死了,并且与 Java 11 不兼容.

We are using PowerMock in few of our historical projects. Unfortunately PowerMock is quite dead and is not compatible with Java 11.

我们使用的是 mockStatic().是的,我们知道它被认为是有害的——它存在于遗留代码中,我们现在不想重写这些类......

And we are using mockStatic(). Yes, we know its considered harmful - its in the legacy code and we would prefer not to rewrite those classes now...

是否有任何选项可以调整 PowerMock 以支持 Java 11?或者是否可以用其他一些 Java 11 兼容框架轻松替换它?(Mockito 不支持 mockStatic)

Are there any options how to tweak PowerMock to support Java 11? Or is it possible to easily replace it with some other Java 11 compatible framework? (Mockito does not support mockStatic)

推荐答案

在一年没有发布之后,PowerMock 的事情真的发生了变化.

After one year of no releases, things are really moving in PowerMock.

PowerMock 2.0.0-RC1 发布.并使用 PowerMockito 2.0.0-RC1+ @PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})

PowerMock 2.0.0-RC1 was released. And with PowerMockito 2.0.0-RC1 + @PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})

测试在 Java 11 下工作.

The tests work under Java 11.

这篇关于PowerMock &爪哇 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆