Hi Dave! I don't have a lot of experience with coders, but I would include the Beam user@ list (added just now) to see if someone else has done this. Best -P.
On Wed, Nov 18, 2020 at 7:22 AM Dave Anderson <drander...@google.com> wrote: > Pablo, > > Also, for now I've created tests that exercise the encode() and decode() > methods directly on the Coder. I was just curious if there was a way to > also test it in the context of a pipeline. > > thanks, > > Dave > > *David Anderson* > > Solution Engineer - Cloud Healthcare & Life Sciences > > drander...@google.com > > > > On Wed, Nov 18, 2020 at 9:17 AM Dave Anderson <drander...@google.com> > wrote: > >> Hi Pablo, >> >> I was wondering if you could point me to any resources that might help me >> address a challenge I've run into when unit testing a Custom Coder I have >> created as part of the Whistle ELP project. >> >> The regular tests where I'm using PAssert to check the value returning >> from a call to >> p.apply( "Create from test objects", >> Create.of(runtimeContext).withCoder(RuntimeContextCoder.of())); >> >> are working fine. The issue arises when I throw an exception from the >> coder, for example when a null object is passed in to the encode() or >> decode() methods. >> >> I've tried to use Assert.assertThrows() for the test case, and it is >> actually succeeding in that check, but the pipeline continues to run and I >> end up with a NPE. >> >> Outputs for non-root node Create from test objects are null >> java.lang.NullPointerException: Outputs for non-root node Create from >> test objects are null >> >> Have you ever written unit tests using the TestPipeline that are testing >> for exceptions being thrown? Am I missing something really obvious? >> >> Also, feel free to direct me to a mailing list if there's an appropriate >> one for this. You have just been incredibly helpful with the FhirIO, >> HL7v2IO, and the DicomIO efforts, so I figured I'd ping you to get some >> direction. >> >> thanks, >> >> Dave >> >> [image: image.png] >> >> *David Anderson* >> >> Solution Engineer - Cloud Healthcare & Life Sciences >> >> drander...@google.com >> >> >>