PerformanceMonitorBeanFactory extends PerformanceMonitorFactory implements InitializingBean { public PerformanceMonitorBean findPerformanceMonitorBean(String name) { PerformanceMonitor performanceMonitor = findPerformanceMonitor(name); if (performanceMonitor instanceof PerformanceMonitorBean) { return (PerformanceMonitorBean)performanceMonitor; } return null; } PerformanceMonitorBeanFactory(); void afterPropertiesSet(); void setInitialPerformanceMonitors(List<String> initialPerformanceMonitors); void setPackageScanBase(String packageScanBase); void createInitialPerformanceMonitors(); @Deprecated void setMBeanExporter(MBeanExporter mBeanExporter); void setMBeanExportOperations(MBeanExportOperations mBeanExportOperations); synchronized PerformanceMonitor createPerformanceMonitor(
            String name); PerformanceMonitorBean findPerformanceMonitorBean(String name);  }
@Test public void testFindPerformanceMonitorBean() { String monitorName = "testFind"; PerformanceMonitor createdMonitor = factory.createPerformanceMonitor(monitorName); PerformanceMonitorBean foundMonitor = factory.findPerformanceMonitorBean(monitorName); assertNotNull(foundMonitor); assertEquals(createdMonitor, foundMonitor); }
@Test public void testFindInvalidPerformanceMonitorBean() { String monitorName = "testFindInvalid"; Map<String, PerformanceMonitor> invalidMap = new HashMap<String, PerformanceMonitor>(); invalidMap.put(monitorName, new PerformanceMonitor()); ReflectionTestUtils.setField( factory, "performanceMonitorMap", invalidMap); PerformanceMonitorBean foundMonitor = factory.findPerformanceMonitorBean(monitorName); assertNull(foundMonitor); }