### Question:
ShareNotificationRenderer implements FXMessageRenderer { @Override public String renderString(String dropPayload, ResourceBundle resourceBundle) { ShareNotificationMessage message = ShareNotificationMessage.fromJson(dropPayload); String filename; try { BoxObject file = sharingService.loadFileMetadata(message, downloader); filename = file.getName(); } catch (QblStorageNotFound e) { filename = resourceBundle.getString("sharedFileNoLongerAvailable"); } catch (Exception e) { filename = resourceBundle.getString("remoteFileFailedToFetchShareMetadata"); } return filename + "\n(\"" + message.getMsg() + "\")"; } ShareNotificationRenderer(AuthenticatedDownloader downloader, SharingService sharingService); @Override Node render(String alias, String dropPayload, ResourceBundle resourceBundle); @Override String renderString(String dropPayload, ResourceBundle resourceBundle);  }### Answer:
@Test public void rendersString() { String message = renderer.renderString(share.toJson(), resourceBundle); assertEquals("sharedFile\n(\"shareMessage\")", message); }
@Test public void renderStringHandlesOutdatedShares() { sharingService.storageException = new QblStorageNotFound("file not found"); String message = renderer.renderString(share.toJson(), resourceBundle); assertEquals("sharedFileNoLongerAvailableTranslation\n(\"shareMessage\")", message); }
@Test public void renderStringHandlesOtherMetadataLoadingExceptions() { sharingService.ioException = new IOException("something failed..."); String message = renderer.renderString(share.toJson(), resourceBundle); assertEquals("remoteFileFailedToFetchShareMetadataTranslation\n(\"shareMessage\")", message); }