EmulatorProviderImpl implements EmulatorProvider { @Override public boolean handles(Resource resource) { Page page = resource.adaptTo(Page.class); if (page != null) { String templatePath = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class); if (StringUtils.isNotEmpty(templatePath)) { for (Pattern pattern : templatePathPatterns) { Matcher matcher = pattern.matcher(templatePath); if (matcher.matches()) { return true; } } } } return false; }  @Override boolean handles(Resource resource); @Override List<Emulator> getEmulators(Resource resource); @Override List<EmulatorGroup> getEmulatorGroups(Resource resource);  }
@Test void testHandles() { assertTrue(underTest.handles(page1.adaptTo(Resource.class))); assertTrue(underTest.handles(page2.adaptTo(Resource.class))); assertFalse(underTest.handles(page3.adaptTo(Resource.class))); }