How to JUnit test that two List contain the same elements in the same order?

前端 未结 7 1644
星月不相逢
星月不相逢 2021-02-01 00:39

Context

I am writing a simple JUnit test for the MyObject class.

A MyObject can be created from a static factory met

7条回答
  •  灰色年华
    2021-02-01 00:51

    The equals() method on your List implementation should do elementwise comparison, so

    assertEquals(argumentComponents, returnedComponents);
    

    is a lot easier.

提交回复
热议问题