@Test public void mailFeedback_confirmNotification() throws Exception { request.addHeader("x-amz-sns-message-type", "SubscriptionConfirmation"); setJsonContent("{" + " 'Type':'SubscriptionConfirmation'," + " 'MessageId':'8b0f0abf-09f4-4208-bb88-a333a53615e0'," + " 'SubscribeURL':'http: + "}"); controller.mailFeedback(request); }
@RequestMapping(value = "/mail-feedback", method = RequestMethod.POST) public void mailFeedback(HttpServletRequest request) throws IOException { String messageType = Optional.ofNullable(request.getHeader("x-amz-sns-message-type")) .map(Strings::emptyToNull) .orElse(NO_SUCH_FIELD); switch (messageType) { case "SubscriptionConfirmation": handleSubscriptionConfirmation(request); break; case "Notification": handleNotification(request); break; default: logger.warn("receive unknown sns, headers:\n" + dumpHeaders(request) + "\nbody:\n" + inputToString(request.getInputStream())); break; } }
AwsSnsRestController { @RequestMapping(value = "/mail-feedback", method = RequestMethod.POST) public void mailFeedback(HttpServletRequest request) throws IOException { String messageType = Optional.ofNullable(request.getHeader("x-amz-sns-message-type")) .map(Strings::emptyToNull) .orElse(NO_SUCH_FIELD); switch (messageType) { case "SubscriptionConfirmation": handleSubscriptionConfirmation(request); break; case "Notification": handleNotification(request); break; default: logger.warn("receive unknown sns, headers:\n" + dumpHeaders(request) + "\nbody:\n" + inputToString(request.getInputStream())); break; } } }
AwsSnsRestController { @RequestMapping(value = "/mail-feedback", method = RequestMethod.POST) public void mailFeedback(HttpServletRequest request) throws IOException { String messageType = Optional.ofNullable(request.getHeader("x-amz-sns-message-type")) .map(Strings::emptyToNull) .orElse(NO_SUCH_FIELD); switch (messageType) { case "SubscriptionConfirmation": handleSubscriptionConfirmation(request); break; case "Notification": handleNotification(request); break; default: logger.warn("receive unknown sns, headers:\n" + dumpHeaders(request) + "\nbody:\n" + inputToString(request.getInputStream())); break; } } AwsSnsRestController(); @VisibleForTesting  AwsSnsRestController(AccountService accountService); }
AwsSnsRestController { @RequestMapping(value = "/mail-feedback", method = RequestMethod.POST) public void mailFeedback(HttpServletRequest request) throws IOException { String messageType = Optional.ofNullable(request.getHeader("x-amz-sns-message-type")) .map(Strings::emptyToNull) .orElse(NO_SUCH_FIELD); switch (messageType) { case "SubscriptionConfirmation": handleSubscriptionConfirmation(request); break; case "Notification": handleNotification(request); break; default: logger.warn("receive unknown sns, headers:\n" + dumpHeaders(request) + "\nbody:\n" + inputToString(request.getInputStream())); break; } } AwsSnsRestController(); @VisibleForTesting  AwsSnsRestController(AccountService accountService); @RequestMapping(value = "/mail-feedback", method = RequestMethod.POST) void mailFeedback(HttpServletRequest request); }
AwsSnsRestController { @RequestMapping(value = "/mail-feedback", method = RequestMethod.POST) public void mailFeedback(HttpServletRequest request) throws IOException { String messageType = Optional.ofNullable(request.getHeader("x-amz-sns-message-type")) .map(Strings::emptyToNull) .orElse(NO_SUCH_FIELD); switch (messageType) { case "SubscriptionConfirmation": handleSubscriptionConfirmation(request); break; case "Notification": handleNotification(request); break; default: logger.warn("receive unknown sns, headers:\n" + dumpHeaders(request) + "\nbody:\n" + inputToString(request.getInputStream())); break; } } AwsSnsRestController(); @VisibleForTesting  AwsSnsRestController(AccountService accountService); @RequestMapping(value = "/mail-feedback", method = RequestMethod.POST) void mailFeedback(HttpServletRequest request);  }