### Question:
SlackFlickrMessageRenderer { public static BentenSlackResponse renderList(PhotoList<Photo> photos) { BentenSlackResponse bentenSlackResponse = new BentenSlackResponse(); SlackFormatter slackFormatter = SlackFormatter.create(); List<BentenSlackAttachment> attachments = new ArrayList<>(); if (photos.size() > 0) { slackFormatter.text(String.format("Results found (%d):\n", photos.size())); for (Photo photo : photos) { BentenSlackAttachment attachment = new BentenSlackAttachment(); attachment.setTitle(photo.getTitle()); attachment.setTitle_link(photo.getUrl()); attachment.setThumb_url(photo.getSmallUrl()); attachments.add(attachment); } } else { slackFormatter.text("No photos found."); } bentenSlackResponse.setSlackText(slackFormatter.build()); bentenSlackResponse.setBentenSlackAttachments(attachments); return bentenSlackResponse; }  static BentenSlackResponse renderList(PhotoList<Photo> photos); static BentenSlackResponse renderList(List<Camera> cameras);  }### Answer:
@Test public void testRenderListForNoCameras() { List<Camera> mockResults = new ArrayList<>(); BentenSlackResponse response = SlackFlickrMessageRenderer.renderList(mockResults); Assert.hasText(response.getSlackText(), "Should have slack message"); Assert.isTrue(response.getBentenSlackAttachments().size() == 0, "Should have no attachments"); }
@Test public void testRenderListForCameras() { List<Camera> mockResults = FlickrResultBuilder.getCamerasFromJSON("camera-by-brand.json"); BentenSlackResponse response = SlackFlickrMessageRenderer.renderList(mockResults); Assert.isTrue(response.getSlackText().split("\n").length == 4, "Should have 4 lines of text"); }
@Test public void testRenderListForNoPhotos() { PhotoList<Photo> mockResults = new PhotoList<>(); BentenSlackResponse response = SlackFlickrMessageRenderer.renderList(mockResults); Assert.hasText(response.getSlackText(), "Should have slack message"); Assert.isTrue(response.getBentenSlackAttachments().size() == 0, "Should have no attachments"); }
@Test public void testRenderListForPhotos() { PhotoList<Photo> mockResults = new PhotoList<>(); for (int i = 0; i < 3; i++) { mockResults.add(new Photo()); } BentenSlackResponse response = SlackFlickrMessageRenderer.renderList(mockResults); Assert.hasText(response.getSlackText(), "Should have slack message"); Assert.isTrue(response.getBentenSlackAttachments().size() == 3, "Should have 3 attachments"); }