### Question:
AWSSNSMetaDataExtension extends AbstractMetaDataExtension { @Override public Optional<MetaData> meta(Map<String, Object> parameters) { final String accessKey = ConnectorOptions.extractOption(parameters, "accessKey"); final String secretKey = ConnectorOptions.extractOption(parameters, "secretKey"); final String region = ConnectorOptions.extractOption(parameters, "region"); AmazonSNSClientBuilder clientBuilder; AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); clientBuilder = AmazonSNSClientBuilder.standard().withCredentials(credentialsProvider); clientBuilder = clientBuilder.withRegion(Regions.valueOf(region)); AmazonSNS sqsClient = clientBuilder.build(); try { ListTopicsResult result = sqsClient.listTopics(); Set<String> setTopic = new HashSet<String>(); if (result.getTopics() != null) { for (Topic entry : result.getTopics()) { setTopic.add(entry.getTopicArn()); } } return Optional.of(MetaDataBuilder.on(getCamelContext()).withAttribute(MetaData.CONTENT_TYPE, "text/plain").withAttribute(MetaData.JAVA_TYPE, String.class) .withPayload(setTopic).build()); } catch (Exception e) { throw new IllegalStateException("Get information about existing topics with has failed.", e); } } AWSSNSMetaDataExtension(CamelContext context); @Override Optional<MetaData> meta(Map<String, Object> parameters);  }### Answer:
@Test public void retrieveQueuesListTest() { CamelContext context = new DefaultCamelContext(); AWSSNSMetaDataExtension extension = new AWSSNSMetaDataExtension(context); Map<String, Object> properties = new HashMap<>(); properties.put("accessKey", "accessKey"); properties.put("secretKey", "secretKey"); properties.put("region", "region"); Optional<MetaDataExtension.MetaData> meta = extension.meta(properties); assertThat(meta).isPresent(); assertThat(meta.get().getPayload()).isInstanceOf(HashSet.class); assertThat(meta.get().getAttributes()).hasEntrySatisfying(MetaDataExtension.MetaData.JAVA_TYPE, new Condition<Object>() { @Override public boolean matches(Object val) { return Objects.equals(String.class, val); } }); assertThat(meta.get().getAttributes()).hasEntrySatisfying(MetaDataExtension.MetaData.CONTENT_TYPE, new Condition<Object>() { @Override public boolean matches(Object val) { return Objects.equals("text/plain", val); } }); }
@Test public void noChannelTest() { CamelContext context = new DefaultCamelContext(); AWSSNSMetaDataExtension extension = new AWSSNSMetaDataExtension(context); Map<String, Object> properties = new HashMap<>(); properties.put("webhookurl", "token"); Optional<MetaDataExtension.MetaData> meta = extension.meta(properties); assertThat(meta).isEmpty(); }