@Test public void invalidProfilePassed() throws Exception { String json = Resources.toString(Resources.getResource("inconsistent_quicklinks_profile.json"), Charsets.UTF_8); assertTrue( "An instance of " + ShowAllLinksVisibilityController.class.getSimpleName() + " should have been returned", QuickLinkVisibilityControllerFactory.get(json) instanceof ShowAllLinksVisibilityController); json = Resources.toString(Resources.getResource("inconsistent_quicklinks_profile_2.json"), Charsets.UTF_8); assertTrue( "An instance of " + ShowAllLinksVisibilityController.class.getSimpleName() + " should have been returned", QuickLinkVisibilityControllerFactory.get(json) instanceof ShowAllLinksVisibilityController); }
public static QuickLinkVisibilityController get(@Nullable String quickLinkProfileJson) { if (null == quickLinkProfileJson) { LOG.info("No quick link profile is set, will display all quicklinks."); return new ShowAllLinksVisibilityController(); } try { QuickLinksProfile profile = new QuickLinksProfileParser().parse(quickLinkProfileJson.getBytes()); return new DefaultQuickLinkVisibilityController(profile); } catch (IOException | QuickLinksProfileEvaluationException ex) { LOG.error("Unable to parse quick link profile json: " + quickLinkProfileJson, ex); return new ShowAllLinksVisibilityController(); } }
QuickLinkVisibilityControllerFactory { public static QuickLinkVisibilityController get(@Nullable String quickLinkProfileJson) { if (null == quickLinkProfileJson) { LOG.info("No quick link profile is set, will display all quicklinks."); return new ShowAllLinksVisibilityController(); } try { QuickLinksProfile profile = new QuickLinksProfileParser().parse(quickLinkProfileJson.getBytes()); return new DefaultQuickLinkVisibilityController(profile); } catch (IOException | QuickLinksProfileEvaluationException ex) { LOG.error("Unable to parse quick link profile json: " + quickLinkProfileJson, ex); return new ShowAllLinksVisibilityController(); } } }
QuickLinkVisibilityControllerFactory { public static QuickLinkVisibilityController get(@Nullable String quickLinkProfileJson) { if (null == quickLinkProfileJson) { LOG.info("No quick link profile is set, will display all quicklinks."); return new ShowAllLinksVisibilityController(); } try { QuickLinksProfile profile = new QuickLinksProfileParser().parse(quickLinkProfileJson.getBytes()); return new DefaultQuickLinkVisibilityController(profile); } catch (IOException | QuickLinksProfileEvaluationException ex) { LOG.error("Unable to parse quick link profile json: " + quickLinkProfileJson, ex); return new ShowAllLinksVisibilityController(); } }  }
QuickLinkVisibilityControllerFactory { public static QuickLinkVisibilityController get(@Nullable String quickLinkProfileJson) { if (null == quickLinkProfileJson) { LOG.info("No quick link profile is set, will display all quicklinks."); return new ShowAllLinksVisibilityController(); } try { QuickLinksProfile profile = new QuickLinksProfileParser().parse(quickLinkProfileJson.getBytes()); return new DefaultQuickLinkVisibilityController(profile); } catch (IOException | QuickLinksProfileEvaluationException ex) { LOG.error("Unable to parse quick link profile json: " + quickLinkProfileJson, ex); return new ShowAllLinksVisibilityController(); } }  static QuickLinkVisibilityController get(@Nullable String quickLinkProfileJson); }
QuickLinkVisibilityControllerFactory { public static QuickLinkVisibilityController get(@Nullable String quickLinkProfileJson) { if (null == quickLinkProfileJson) { LOG.info("No quick link profile is set, will display all quicklinks."); return new ShowAllLinksVisibilityController(); } try { QuickLinksProfile profile = new QuickLinksProfileParser().parse(quickLinkProfileJson.getBytes()); return new DefaultQuickLinkVisibilityController(profile); } catch (IOException | QuickLinksProfileEvaluationException ex) { LOG.error("Unable to parse quick link profile json: " + quickLinkProfileJson, ex); return new ShowAllLinksVisibilityController(); } }  static QuickLinkVisibilityController get(@Nullable String quickLinkProfileJson);  }