DictionaryServiceImpl implements DictionaryService, ManagedService { public void setPattern(String p) { try { compilesPattern = Pattern.compile(p); pattern = p; } catch (RuntimeException e) { logger.error("Failed to compile pattern '{}'", p); } }  void setPattern(String p); String getPattern(); @Override synchronized void updated(Dictionary<String, ?> properties); @Override Textual cleanUpText(String text); static final String PATTERN_CONFIG_KEY; }
@Test public void testSetPattern() throws Exception { DictionaryServiceImpl service = new DictionaryServiceImpl(); String pattern = "123"; service.setPattern(pattern); Assert.assertEquals(pattern, service.getPattern()); }