title: Unit testing AWS SNS Publishing message
body: <p>I'm wondering how can I test a method like this:</p>
  
  <pre><code>public PublishResponse broadcast(String eventJson, Class&lt;? extends BaseEvent&gt; type) {
      //Build Sns client.
      AwsCredentials awsCredentials = AwsBasicCredentials
              .create(snsConfiguration.getAwsAccessKeyId(), snsConfiguration.getAwsSecretAccessKey());
      StaticCredentialsProvider credentialsProvider = StaticCredentialsProvider.create(awsCredentials);
      SnsClient snsClient = SnsClient.builder().credentialsProvider(credentialsProvider).build();
      //Prepare message attributes.
      Map&lt;String, MessageAttributeValue&gt; messageAttributes = new HashMap&lt;&gt;();
      MessageAttributeValue messageAttributeValue = MessageAttributeValue.builder().dataType("String").stringValue(type.getName())
              .build();
      messageAttributes.put("type", messageAttributeValue);
      //Publish message with event json to Amazon SNS.
      return snsClient.publish(PublishRequest.builder()
              .message(eventJson)
              .messageAttributes(messageAttributes)
              .topicArn(snsConfiguration.getTopicARN())
              .build());
  }
  </code></pre>
  
  <p>All the code here depend on AWS SDK api. I know that I could some moking here but at the end time his method's responsibility is to send a message to SNS. How to write united  testing for such thing?</p>