HL7v2IO { public static Write ingestMessages(String hl7v2Store) { return write(hl7v2Store).setWriteMethod(Write.WriteMethod.INGEST).build(); }  static Read getAll(); static ListHL7v2Messages readAll(List<String> hl7v2Stores); static ListHL7v2Messages readAll(ValueProvider<List<String>> hl7v2Stores); static ListHL7v2Messages read(String hl7v2Store); static ListHL7v2Messages read(ValueProvider<String> hl7v2Store); static ListHL7v2Messages readWithFilter(String hl7v2Store, String filter); static ListHL7v2Messages readWithFilter(
      ValueProvider<String> hl7v2Store, ValueProvider<String> filter); static ListHL7v2Messages readAllWithFilter(List<String> hl7v2Stores, String filter); static ListHL7v2Messages readAllWithFilter(
      ValueProvider<List<String>> hl7v2Stores, ValueProvider<String> filter); static Write ingestMessages(String hl7v2Store);  }
@Test public void test_HL7v2IO_failedWrites() { Message msg = new Message().setData(""); List<HL7v2Message> emptyMessages = Collections.singletonList(HL7v2Message.fromModel(msg)); PCollection<HL7v2Message> messages = pipeline.apply(Create.of(emptyMessages).withCoder(new HL7v2MessageCoder())); HL7v2IO.Write.Result writeResult = messages.apply( HL7v2IO.ingestMessages( "projects/foo/locations/us-central1/datasets/bar/hl7V2Stores/baz")); PCollection<HealthcareIOError<HL7v2Message>> failedInserts = writeResult.getFailedInsertsWithErr(); PCollection<Long> failedMsgs = failedInserts.apply(Count.globally()); PAssert.thatSingleton(failedMsgs).isEqualTo(1L); pipeline.run(); }