PowerMock& Java 11 [英] PowerMock & Java 11

查看:221
本文介绍了PowerMock& Java 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不支持模拟静态)

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& Java 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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