public static <T> Write<T> write() {
    return new AutoValue_SnsIO_Write.Builder<T>()
        .setClientConfiguration(ClientConfiguration.builder().build())
        .build();
  }
@Test
  public void testFailOnTopicValidation() {
    PCollection<String> input = mock(PCollection.class);
    when(input.getPipeline()).thenReturn(p);
    when(sns.getTopicAttributes(any(Consumer.class)))
        .thenThrow(InvalidParameterException.builder().message("Topic does not exist").build());

    Write<String> snsWrite =
        SnsIO.<String>write()
            .withTopicArn(topicArn)
            .withPublishRequestBuilder(msg -> requestBuilder(msg, "ignore"));

    assertThatThrownBy(() -> snsWrite.expand(input))
        .hasMessage("Topic arn " + topicArn + " does not exist");
  }