@Test public void testResolveMainPanelRendererLabelContentTemplate() throws Exception { final ContentService contentService = context.mock(ContentService.class, "contentService"); context.checking(new Expectations() {{ oneOf(contentService).getContentTemplate(10L); will(returnValue(CentralViewLabel.DYNOCONTENT)); }}); CentralViewResolverContentImpl resolver = new CentralViewResolverContentImpl(contentService); final Pair<String, String> resolved = resolver.resolveMainPanelRendererLabel(new HashMap<String, String>() {{ put(WebParametersKeys.CONTENT_ID, "10"); }}); assertNotNull(resolved); assertEquals(CentralViewLabel.DYNOCONTENT, resolved.getFirst()); assertEquals(CentralViewLabel.DYNOCONTENT, resolved.getSecond()); context.assertIsSatisfied(); }
@Override public Pair<String, String> resolveMainPanelRendererLabel(final Map parameters) { if (parameters.containsKey(WebParametersKeys.CONTENT_ID)) { final long contentId = NumberUtils.toLong(HttpUtil.getSingleValue(parameters.get(WebParametersKeys.CONTENT_ID))); if (contentId > 0L) { final String template = contentService.getContentTemplate(contentId); if (StringUtils.isNotBlank(template)) { if (CentralViewLabel.DYNOCONTENT.equals(template)) { return DEFAULT_DYNO; } return new Pair<>(template, CentralViewLabel.CONTENT); } return DEFAULT; } } return null; }
CentralViewResolverContentImpl implements CentralViewResolver { @Override public Pair<String, String> resolveMainPanelRendererLabel(final Map parameters) { if (parameters.containsKey(WebParametersKeys.CONTENT_ID)) { final long contentId = NumberUtils.toLong(HttpUtil.getSingleValue(parameters.get(WebParametersKeys.CONTENT_ID))); if (contentId > 0L) { final String template = contentService.getContentTemplate(contentId); if (StringUtils.isNotBlank(template)) { if (CentralViewLabel.DYNOCONTENT.equals(template)) { return DEFAULT_DYNO; } return new Pair<>(template, CentralViewLabel.CONTENT); } return DEFAULT; } } return null; } }
CentralViewResolverContentImpl implements CentralViewResolver { @Override public Pair<String, String> resolveMainPanelRendererLabel(final Map parameters) { if (parameters.containsKey(WebParametersKeys.CONTENT_ID)) { final long contentId = NumberUtils.toLong(HttpUtil.getSingleValue(parameters.get(WebParametersKeys.CONTENT_ID))); if (contentId > 0L) { final String template = contentService.getContentTemplate(contentId); if (StringUtils.isNotBlank(template)) { if (CentralViewLabel.DYNOCONTENT.equals(template)) { return DEFAULT_DYNO; } return new Pair<>(template, CentralViewLabel.CONTENT); } return DEFAULT; } } return null; } CentralViewResolverContentImpl(final ContentService contentService); }
CentralViewResolverContentImpl implements CentralViewResolver { @Override public Pair<String, String> resolveMainPanelRendererLabel(final Map parameters) { if (parameters.containsKey(WebParametersKeys.CONTENT_ID)) { final long contentId = NumberUtils.toLong(HttpUtil.getSingleValue(parameters.get(WebParametersKeys.CONTENT_ID))); if (contentId > 0L) { final String template = contentService.getContentTemplate(contentId); if (StringUtils.isNotBlank(template)) { if (CentralViewLabel.DYNOCONTENT.equals(template)) { return DEFAULT_DYNO; } return new Pair<>(template, CentralViewLabel.CONTENT); } return DEFAULT; } } return null; } CentralViewResolverContentImpl(final ContentService contentService); @Override Pair<String, String> resolveMainPanelRendererLabel(final Map parameters); }
CentralViewResolverContentImpl implements CentralViewResolver { @Override public Pair<String, String> resolveMainPanelRendererLabel(final Map parameters) { if (parameters.containsKey(WebParametersKeys.CONTENT_ID)) { final long contentId = NumberUtils.toLong(HttpUtil.getSingleValue(parameters.get(WebParametersKeys.CONTENT_ID))); if (contentId > 0L) { final String template = contentService.getContentTemplate(contentId); if (StringUtils.isNotBlank(template)) { if (CentralViewLabel.DYNOCONTENT.equals(template)) { return DEFAULT_DYNO; } return new Pair<>(template, CentralViewLabel.CONTENT); } return DEFAULT; } } return null; } CentralViewResolverContentImpl(final ContentService contentService); @Override Pair<String, String> resolveMainPanelRendererLabel(final Map parameters);  }