AbstractMetaDataDiscovery implements BdaScannerService { private boolean isAnonymous(final String className) { final int start = className.lastIndexOf('$'); if (start <= 0) { return false; } try { Integer.parseInt(className.substring(start + 1)); return true; } catch (final NumberFormatException nfe) { return false; } }  Map<String, URL> getBeanDeploymentUrls(); @Override void scan(); @Override void release(); @Override void init(Object object); void initScanningExcludes(); Map<BeanArchiveService.BeanArchiveInformation, Set<Class<?>>> getBeanClassesPerBda(); @Override Set<Class<?>> getBeanClasses(); @Override Set<URL> getBeanXmls(); @Override BDABeansXmlScanner getBDABeansXmlScanner(); @Override boolean isBDABeansXmlScanningEnabled(); static final String META_INF_BEANS_XML; }
@Test public void isAnonymous() throws Exception { final AbstractMetaDataDiscovery mock = new AbstractMetaDataDiscovery() { @Override protected void configure() { } }; final Method mtd = AbstractMetaDataDiscovery.class.getDeclaredMethod("isAnonymous", String.class); mtd.setAccessible(true); assertFalse(Boolean.class.cast(mtd.invoke(mock, AbstractMetaDataDiscoveryTest.class.getName()))); assertTrue(Boolean.class.cast(mtd.invoke(mock, AbstractMetaDataDiscoveryTest.class.getName() + "$1"))); assertTrue(Boolean.class.cast(mtd.invoke(mock, AbstractMetaDataDiscoveryTest.class.getName() + "$1$2"))); assertTrue(Boolean.class.cast(mtd.invoke(mock, AbstractMetaDataDiscoveryTest.class.getName() + "$15$222"))); }