/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public String postProcess (final @Nonnull String link) { try { final String parameterValue = parameterLanguageOverrideRequestProcessor.getParameterValue(); return postProcess(link, parameterValue); } catch (NotFoundException e) { return link; } }
@Test(dataProvider = "linkProvider") public void must_properly_postProcess (final @Nonnull String link, final @Nonnull String parameterValue, final @Nonnull String expectedResult) { final String result = underTest.postProcess(link, parameterValue); assertThat(result, is(expectedResult)); }
@Override @Nonnull protected String filter (final @Nonnull Matcher matcher) throws NotFoundException, IOException { final String relativePath = matcher.group(1); final String contentRelativePath = matcher.group(2); final String language = matcher.group(4); final Site site = siteProvider.get().getSite(); final SiteNode siteNode = site.find(SiteNode.class).withRelativePath(relativePath).result(); final Content content = site.find(Content.class).withRelativePath(contentRelativePath).result(); final ResourcePath path = siteNode.getRelativeUri().appendedWith(content.getExposedUri()); final String link = site.createLink(path); return ((language == null) || (postProcessor == null)) ? link : postProcessor.postProcess(link, language); }