@Test public void renderStringHandlesOutdatedShares() { sharingService.storageException = new QblStorageNotFound("file not found"); String message = renderer.renderString(share.toJson(), resourceBundle); assertEquals("sharedFileNoLongerAvailableTranslation\n(\"shareMessage\")", message); }
@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 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 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); }
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); }
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);  }