开发者

Support for loose collection validation in a Java unit testing framework

开发者 https://www.devze.com 2022-12-08 05:11 出处:网络
Any Java unit testing framework that supports writing unit testing code like this: Collection<AType> myCollection = objectUnderTest.doSomething();

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

精彩评论

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