开发者

Support for loose collection validation in a Java unit testing framework

Any Java unit testing framework that supports writing unit testing code like this:

Collection<AType> myCollection = objectUnderTest.doSomething();
assertCollectionContainsAtleast(myCollection, "a Expected value");

Meaning what I would like is some sort of iteration support with some sort of开发者_运维技巧 matcher attached.


Take a look at Hamcrest, which contains assertions for many things, including collections. You can use hasItem, hasKey, hasValue etc.


You might also take a look at Unitil's assertion utilities.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜