user3426014 user3426014 - 3 years ago 152
Scala Question

Compare nested lists using scala test

How do I compare two list of lists using scala test?

val actual = Array(Row("1", "2"), Row("3", "4"))
val fail_expected = Array(Row("1", "2"), Row("3", "2"))
val pass_expected = Array(Row("3", "4"), Row("1", "2"))

I have tried with

actual should contain theSameElementsAs pass_expected

but it is not working, it says that the two arrays are different, when they are actually the same.

I am using funsuite with scala test.

Answer Source

Thank you guys for the response, actually it works already, it's my expected answer that is wrong.

Edit: Sorry, for the confusion. I mean the initial way of doing it is already correct, it is my expected answer that has error.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download