PinterestUrlProcessor implements UrlProcessor { @Override public Result process(String url) { if (StringUtils.isNotEmpty(url)) { Matcher matcher = pattern.matcher(url); if (matcher.matches()) { return new UrlProcessorResultImpl( NAME, new HashMap<String, Object>() {{ put(PIN_ID, matcher.group(1)); }}); } } return null; }  @Override Result process(String url);  }
@Test void test() { PinterestUrlProcessor processor = new PinterestUrlProcessor(); UrlProcessor.Result result = processor.process("https: assertNotNull(result); assertEquals(PinterestUrlProcessor.NAME, result.getProcessor()); assertEquals("99360735500167749", result.getOptions().get(PinterestUrlProcessor.PIN_ID)); assertNull(processor.process("blah-blah")); }