In the unittest for my DoFo, is it possible to assert the output matches the expected output by comparing the serialized representations of the records?
I've defined a record which uses a default avro coder e.g
@DefaultCoder(AvroCoder.class)
public class JobLogMessage {
@Nullable
public String projectId;
...
}
I'm writing a unittest for a DoFn that uses DoFnTester to produce a list of JobLogMessage's e.g.
JogLogTransforms.ParsJsonDoFn doFn = new JogLogTransforms.ParsJsonDoFn();
DoFnTester<String, JobLogMessage> fnTester = DoFnTester.of(doFn);
List<JobLogMessage> outputs = fnTester.processBatch(inputs.toArray(new String[inputs.size()]));
I'd like to verify that outputs matches the expected outputs. However if I just use assertEquals I think that will use the equals method which won't correctly evaluate equality unless I explicitly overload equals in JobLogMessage.
What I'd like to do is compare the expected and actual JobLogMessage's by comparing the serialized byte representations produced by AvroCoder. Does Dataflow produce any convenience methods for this?