dimanche 29 juillet 2018

How to use custom comparator / diff in PAssert of PCollection

I have a code similar to the one below transforming a PCollections of Protocol Buffer messages. Because some of them are pretty big I want to not only test it using for equality but also print where's the difference.

I want to use https://google.github.io/truth/fuzzy tests which offer to print a difference.

PCollection<PbMsg1> p1 = ...;
List<PbMsg1> p2 = loadFixture();

PAssert.that(p1).containsInAnyOrder(output.getUserReqList());

The question is either:

  1. How to use custom diff / compare function in PAssert?
  2. How to convert from a PCollection to List?

Aucun commentaire:

Enregistrer un commentaire