Mockito的局限性 [英] Mockito limitations

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

问题描述

页面的底部,可以阅读:

In the bottom of this page, one can read:

字段不能声明为final或static(但支持私有字段).

Fields may not be declared as final or static (but private fields are supported).

是什么意思?是否说明在测试类中我无法使用静态或最终的@Mock字段进行注释?

what does it mean? Is it telling that within a test-class I can not annotate with @Mock fields that are static or final?

推荐答案

我们为代码的动态行为编写了单元测试. Mockito不支持测试常量字段,JMock将支持.

We write unit tests for dynamic behavior of the code. Mockito doesn't support testing constants fields, JMock will do.

这篇关于Mockito的局限性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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