简体   繁体   中英

Assert without failure with Mockito

我正在使用Mockito和PowerMock在Java中进行单元测试,我想知道是否有任何方法可以断言,但是它只能向我显示警告,而不会像运行测试失败那样产生影响。

Assertion is boolean; it either is or isn't true. JUnit interprets a failing condition as failure, and this is not a thing that is configured to change.

Ultimately, you're going to want to think about what you're testing. If you're attempting to test the validity of something, then assertion and dealing with the failing test is the right way to go about it. If you only want to smoke test, then don't assert anything , although I must strongly discourage you from doing this since the value of the unit test is removed in that scheme.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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