### Question:
S3EventExecutor extends AbstractEventExecutor<S3EventNotification, S3EventResult> { @Override public Optional<S3EventNotification> resolve(byte[] input) { Optional<S3EventNotification> event; try { event = EventDeserializeUtils.resolveAwsEvent( input, S3EventNotification.class, S3_EVENT_CONDITION); event.ifPresent(e -> { ThreadContext.put(EventConstants.LOG_THREAD_CONTEXT_EVENT_KEY, EventConstants.EVENT_SOURCE_S3); logger.info("Successfully deserialized current input to S3EventNotification"); }); } catch (IOException e) { event = Optional.empty(); logger.error("Can not deserialize S3EventNotification", e); } return event; } S3EventExecutor(Class<? extends AbstractEventAction<?>> s3Action); @Override Optional<S3EventNotification> resolve(byte[] input); @Override Supplier<RequestHandler<S3EventNotification, S3EventResult>> getEventHandler(); static final Predicate<S3EventNotification> S3_EVENT_CONDITION; }### Answer:
@Test public void testResolveS3EventViaSNSEventSuccessfully() throws Exception { InputStream input = this.getClass().getClassLoader().getResourceAsStream(S3_VIA_SNS_REQUEST_JSON_TEMPLATE); Optional<S3EventNotification> event = executor.resolve(readJson(input)); assertEquals(1, event.get().getRecords().size()); assertEquals("aws:s3", event.get().getRecords().get(0).getEventSource()); assertEquals("us-east-1", event.get().getRecords().get(0).getAwsRegion()); assertEquals("dev-nsmg-logs-temp", event.get().getRecords().get(0).getS3().getBucket().getName()); assertEquals("transformed_sample_logs.json", event.get().getRecords().get(0).getS3().getObject().getKey()); }