CircuitBreakerBeanFactory extends CircuitBreakerFactory implements InitializingBean { public CircuitBreakerBean findCircuitBreakerBean(String name) { CircuitBreaker circuitBreaker = findCircuitBreaker(name); if (circuitBreaker instanceof CircuitBreakerBean) { return (CircuitBreakerBean) circuitBreaker; } return null; }  void afterPropertiesSet(); @Deprecated void setMBeanExporter(MBeanExporter mBeanExporter); void setMBeanExportOperations(MBeanExportOperations mBeanExportOperations); void setPackageScanBase(String packageScanBase); void buildAnnotatedCircuitBreakers(); synchronized CircuitBreaker createCircuitBreaker(String name, CircuitBreakerConfig config); CircuitBreakerBean findCircuitBreakerBean(String name);  }
@Test public void testFindCircuitBreakerBean() { String breakerName = "testFind"; CircuitBreaker createdBreaker = factory.createCircuitBreaker(breakerName, config); CircuitBreakerBean foundBreaker = factory.findCircuitBreakerBean(breakerName); assertNotNull(foundBreaker); assertEquals(createdBreaker, foundBreaker); }
@Test public void testFindInvalidCircuitBreakerBean() { String breakerName = "testFindInvalid"; ConcurrentHashMap<String, CircuitBreaker> invalidMap = new ConcurrentHashMap<String, CircuitBreaker>(); invalidMap.put(breakerName, new CircuitBreaker()); ReflectionTestUtils.setField(factory, "circuitBreakerMap", invalidMap); CircuitBreakerBean foundBreaker = factory.findCircuitBreakerBean(breakerName); assertNull(foundBreaker); }