是否有用于 Java 自定义集合实现的测试套件? [英] Is there a testsuite for Java custom collections implementation?
本文介绍了是否有用于 Java 自定义集合实现的测试套件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
出于好奇,我为特殊情况编写了一个自己的 Set
简单实现(其中所有可能条目的集合是固定的,但它不是 enum
).这实际上很容易,但很明显,如果没有大量测试,我的实现是无法使用的(也许即便如此,但那是另一个话题;它主要是一个练习).
Out of curiosity, I wrote an own simple implementation of Set
for a special case (where the set of all possible entries is fixed, but it's no enum
). It was actually quite easy, but obviously, my implementation is unusable without a lot of tests (and maybe even then, but that's another topic; it was mainly an exercise).
那么是否有任何可用的测试套件可用于对其进行单元测试?
So is there any testsuite available I could use for unit-testing it?
推荐答案
使用 Guava SetTestSuiteBuilder
.
示例:
它作为 maven central 中guava-testlib"的一部分发布.
It is released as part of "guava-testlib" in maven central.
这篇关于是否有用于 Java 自定义集合实现的测试套件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文