PerformanceMonitorFactory { public PerformanceMonitor findPerformanceMonitor(String name) { return performanceMonitorMap.get(name); } PerformanceMonitorFactory(); synchronized PerformanceMonitor createPerformanceMonitor(String name); PerformanceMonitor findPerformanceMonitor(String name); Set<String> getPerformanceMonitorNames();  }
@Test public void testFindPerformanceMonitor() { String monitorName = "testFind"; PerformanceMonitor createdMonitor = factory.createPerformanceMonitor(monitorName); PerformanceMonitor foundMonitor = factory.findPerformanceMonitor(monitorName); assertNotNull(foundMonitor); assertEquals(createdMonitor, foundMonitor); }
@Test public void testFindNonExistentPerformanceMonitor() { PerformanceMonitor foundMonitor = factory.findPerformanceMonitor("testNonExistent"); assertNull(foundMonitor); }