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

前端 未结 7 1584
星月不相逢
星月不相逢 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:41

    Why not simply use List#equals?

    assertEquals(argumentComponents, imapPathComponents);
    

    Contract of List#equals:

    two lists are defined to be equal if they contain the same elements in the same order.

提交回复
热议问题