@Test public void testEmptyRequest() { Mockito.when(bentenFlickrClient.getBrandCameras("Apple")).thenReturn(new ArrayList<>()); BentenMessage params = FlickrMessageBuilder.constructBrandCamerasMessage("Apple"); BentenHandlerResponse response = flickrBrandCamerasActionHandler.handle(params); Assert.hasText(response.getBentenSlackResponse().getSlackText(), "Should have slack message"); }
@Override public BentenHandlerResponse handle(BentenMessage bentenMessage) { BentenHandlerResponse handlerResponse = new BentenHandlerResponse(); String brandName = BentenMessageHelper.getParameterAsString(bentenMessage, FlickrActionParamaters.PARAMETER_BRAND_NAME); try { List<Camera> result = bentenFlickrClient.getBrandCameras(brandName); handlerResponse.setBentenSlackResponse(SlackFlickrMessageRenderer.renderList(result)); } catch (BentenFlickrException e) { BentenSlackResponse bentenSlackResponse = new BentenSlackResponse(); bentenSlackResponse.setSlackText(String.format("No cameras found for %s", brandName)); handlerResponse.setBentenSlackResponse(bentenSlackResponse); } return handlerResponse; }
FlickrBrandCamerasActionHandler implements BentenActionHandler { @Override public BentenHandlerResponse handle(BentenMessage bentenMessage) { BentenHandlerResponse handlerResponse = new BentenHandlerResponse(); String brandName = BentenMessageHelper.getParameterAsString(bentenMessage, FlickrActionParamaters.PARAMETER_BRAND_NAME); try { List<Camera> result = bentenFlickrClient.getBrandCameras(brandName); handlerResponse.setBentenSlackResponse(SlackFlickrMessageRenderer.renderList(result)); } catch (BentenFlickrException e) { BentenSlackResponse bentenSlackResponse = new BentenSlackResponse(); bentenSlackResponse.setSlackText(String.format("No cameras found for %s", brandName)); handlerResponse.setBentenSlackResponse(bentenSlackResponse); } return handlerResponse; } }
FlickrBrandCamerasActionHandler implements BentenActionHandler { @Override public BentenHandlerResponse handle(BentenMessage bentenMessage) { BentenHandlerResponse handlerResponse = new BentenHandlerResponse(); String brandName = BentenMessageHelper.getParameterAsString(bentenMessage, FlickrActionParamaters.PARAMETER_BRAND_NAME); try { List<Camera> result = bentenFlickrClient.getBrandCameras(brandName); handlerResponse.setBentenSlackResponse(SlackFlickrMessageRenderer.renderList(result)); } catch (BentenFlickrException e) { BentenSlackResponse bentenSlackResponse = new BentenSlackResponse(); bentenSlackResponse.setSlackText(String.format("No cameras found for %s", brandName)); handlerResponse.setBentenSlackResponse(bentenSlackResponse); } return handlerResponse; }  }
FlickrBrandCamerasActionHandler implements BentenActionHandler { @Override public BentenHandlerResponse handle(BentenMessage bentenMessage) { BentenHandlerResponse handlerResponse = new BentenHandlerResponse(); String brandName = BentenMessageHelper.getParameterAsString(bentenMessage, FlickrActionParamaters.PARAMETER_BRAND_NAME); try { List<Camera> result = bentenFlickrClient.getBrandCameras(brandName); handlerResponse.setBentenSlackResponse(SlackFlickrMessageRenderer.renderList(result)); } catch (BentenFlickrException e) { BentenSlackResponse bentenSlackResponse = new BentenSlackResponse(); bentenSlackResponse.setSlackText(String.format("No cameras found for %s", brandName)); handlerResponse.setBentenSlackResponse(bentenSlackResponse); } return handlerResponse; }  @Override BentenHandlerResponse handle(BentenMessage bentenMessage); }
FlickrBrandCamerasActionHandler implements BentenActionHandler { @Override public BentenHandlerResponse handle(BentenMessage bentenMessage) { BentenHandlerResponse handlerResponse = new BentenHandlerResponse(); String brandName = BentenMessageHelper.getParameterAsString(bentenMessage, FlickrActionParamaters.PARAMETER_BRAND_NAME); try { List<Camera> result = bentenFlickrClient.getBrandCameras(brandName); handlerResponse.setBentenSlackResponse(SlackFlickrMessageRenderer.renderList(result)); } catch (BentenFlickrException e) { BentenSlackResponse bentenSlackResponse = new BentenSlackResponse(); bentenSlackResponse.setSlackText(String.format("No cameras found for %s", brandName)); handlerResponse.setBentenSlackResponse(bentenSlackResponse); } return handlerResponse; }  @Override BentenHandlerResponse handle(BentenMessage bentenMessage);  }