public static Write write() {
    return new AutoValue_SnsIO_Write.Builder().build();
  }
@Test
  public void testCustomCoder() throws Exception {
    final PublishRequest request1 = createSampleMessage("my_first_message");

    final TupleTag<PublishResult> results = new TupleTag<>();
    final AmazonSNS amazonSnsSuccess = getAmazonSnsMockSuccess();
    final MockCoder mockCoder = new MockCoder();

    final PCollectionTuple snsWrites =
        p.apply(Create.of(request1))
            .apply(
                SnsIO.write()
                    .withTopicName(topicName)
                    .withAWSClientsProvider(new Provider(amazonSnsSuccess))
                    .withResultOutputTag(results)
                    .withCoder(mockCoder));

    final PCollection<Long> publishedResultsSize =
        snsWrites
            .get(results)
            .apply(MapElements.into(TypeDescriptors.strings()).via(result -> result.getMessageId()))
            .apply(Count.globally());
    PAssert.that(publishedResultsSize).containsInAnyOrder(ImmutableList.of(1L));
    p.run().waitUntilFinish();
    assertThat(mockCoder.captured).isNotNull();
  }