【发布时间】:2020-08-31 16:11:18
【问题描述】:
我有如下三个班级:
public class Foo {
private Long fooId;
private String fooName;
private List<Bar> bars;
}
public class Bar {
private Long barId;
private String barName;
private Foo foo;
}
public class FooBar {
List<Foo> foo;
List<Bar> bars;
}
FooBar 是我在回复中得到的。我对如何比较有点困惑,尤其是Foo 使用hasItem() 的hamcrest.Matchers.* 或者有没有更好的方法。我们如何在 Junit5 中进行比较?
【问题讨论】:
标签: java unit-testing junit5 hamcrest