Home > Enterprise >  PAssert...containsInAnyOrder fails despite the proper result
PAssert...containsInAnyOrder fails despite the proper result

Time:07-14

I have following code:

PAssert.that(output)
            .inWindow(GlobalWindow.INSTANCE)
            .containsInAnyOrder(buildObjectTypeT()...build()

output is produced by

PCollection<T> someMethod

PAssert fail with

Expected: iterable over [<T(id=..
but: Not matched: <T(id=2

CodePudding user response:

The problem is that containsInAnyOrder fails if output contains more than the list of objects that is expected.

Lets say PCollection<T> someMethod produces 3 elements . If containsInAnyOrder(T obj1, T obj2) then PAssert will fail

CodePudding user response:

Based on the error message, the expected is an iterable but given a <T...>. Try enclosing the expected object in an array.

  • Related